Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Issue 2052623003: [wasm] improve handling of malformed input (Closed)

Created:
4 years, 6 months ago by ddchen
Modified:
4 years, 5 months ago
Reviewers:
titzer, bradnelson, bradn, JF
CC:
v8-reviews_googlegroups.com, jochen (gone - plz use gerrit)
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

[wasm] improve handling of malformed inputs When reading malformed input, the length of variable-length types can be very large. Computing operand length with this and adding it to PC will overflow and screw up decode. This patch switches to unsigned int for arity and lengths, terminates loop analysis on error, adds overflow checking to BranchTableOperand, and adds a unit test. Committed: https://crrev.com/fd2bf837a536827ea697a4a4de970886a4c288bc Cr-Commit-Position: refs/heads/master@{#37301}

Patch Set 1 #

Patch Set 2 : remove debugging statement #

Total comments: 1

Patch Set 3 : use unsigned, terminate loop analysis on error, add unit test #

Total comments: 1

Patch Set 4 : add overflow check to BranchTableOperand #

Total comments: 2

Patch Set 5 : use nullptr and decoder error() instead of CHECK() #

Patch Set 6 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+85 lines, -70 lines) Patch
M src/wasm/ast-decoder.h View 1 2 3 4 5 16 chunks +34 lines, -30 lines 0 comments Download
M src/wasm/ast-decoder.cc View 1 2 3 4 5 7 chunks +9 lines, -9 lines 0 comments Download
M src/wasm/decoder.h View 1 2 3 4 5 5 chunks +14 lines, -11 lines 0 comments Download
M test/unittests/wasm/decoder-unittest.cc View 1 2 3 4 5 19 chunks +19 lines, -19 lines 0 comments Download
M test/unittests/wasm/leb-helper-unittest.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M test/unittests/wasm/loop-assignment-analysis-unittest.cc View 1 2 3 1 chunk +8 lines, -0 lines 0 comments Download

Messages

Total messages: 29 (11 generated)
ddchen
AFL generated a test case (https://drive.google.com/a/google.com/file/d/0B8HhUsNH3jEnbTF5RTRLc3pJWE0/view?usp=sharing) that crashes V8 in debug mode. The input is ...
4 years, 6 months ago (2016-06-09 02:33:23 UTC) #2
titzer
Looks mostly good. Can you please add a unit test or cctest for the bug ...
4 years, 6 months ago (2016-06-09 06:48:15 UTC) #3
titzer
On 2016/06/09 02:33:23, ddchen wrote: > AFL generated a test case > (https://drive.google.com/a/google.com/file/d/0B8HhUsNH3jEnbTF5RTRLc3pJWE0/view?usp=sharing) > that ...
4 years, 6 months ago (2016-06-09 06:50:00 UTC) #4
ddchen
Yes, that is still a problem. This patch makes things a little better, but the ...
4 years, 6 months ago (2016-06-09 19:25:39 UTC) #5
titzer
https://codereview.chromium.org/2052623003/diff/40001/src/wasm/ast-decoder.cc File src/wasm/ast-decoder.cc (right): https://codereview.chromium.org/2052623003/diff/40001/src/wasm/ast-decoder.cc#newcode1468 src/wasm/ast-decoder.cc:1468: return (limit_ != start_) ? assigned : NULL; You ...
4 years, 6 months ago (2016-06-10 07:40:00 UTC) #6
titzer
On 2016/06/09 19:25:39, ddchen wrote: > Yes, that is still a problem. This patch makes ...
4 years, 6 months ago (2016-06-10 07:40:53 UTC) #7
ddchen
I added the overflow check, the unit test was in the previous patch set.
4 years, 6 months ago (2016-06-10 20:39:10 UTC) #9
bradnelson
the int -> unsigned thing here is reminding me we need a larger team discussion ...
4 years, 6 months ago (2016-06-24 18:40:47 UTC) #10
ddchen
On 2016/06/24 18:40:47, bradnelson wrote: > the int -> unsigned thing here is reminding me ...
4 years, 6 months ago (2016-06-24 21:10:21 UTC) #11
bradnelson
lgtm
4 years, 5 months ago (2016-06-27 05:00:03 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2052623003/80001
4 years, 5 months ago (2016-06-27 05:00:10 UTC) #14
commit-bot: I haz the power
Try jobs failed on following builders: v8_android_arm_compile_rel on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_android_arm_compile_rel/builds/19791) v8_linux64_asan_rel_ng on master.tryserver.v8 (JOB_FAILED, ...
4 years, 5 months ago (2016-06-27 05:01:27 UTC) #16
bradn
Looks like you need a merge.
4 years, 5 months ago (2016-06-27 05:58:49 UTC) #18
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2052623003/100001
4 years, 5 months ago (2016-06-27 17:21:25 UTC) #20
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 5 months ago (2016-06-27 18:03:51 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2052623003/100001
4 years, 5 months ago (2016-06-27 20:33:34 UTC) #25
commit-bot: I haz the power
Committed patchset #6 (id:100001)
4 years, 5 months ago (2016-06-27 20:35:40 UTC) #27
commit-bot: I haz the power
4 years, 5 months ago (2016-06-27 20:37:40 UTC) #29
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/fd2bf837a536827ea697a4a4de970886a4c288bc
Cr-Commit-Position: refs/heads/master@{#37301}

Powered by Google App Engine
This is Rietveld 408576698