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

Issue 2399873002: ValueSerializer: Add more checks before trying to allocate memory for a dense array. (Closed)

Created:
4 years, 2 months ago by jbroman
Modified:
4 years, 2 months ago
CC:
v8-reviews_googlegroups.com
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

ValueSerializer: Add more checks before trying to allocate memory for a dense array. Found with libfuzzer. The length is automatically converted to int (thus large sizes could become negative, even though they are legal "array sizes"). Besides that, the length is coerced to a SMI (which is an even tighter constraint on 32-bit systems, where it limits the legal sizes to 2^30 - 1). Add checks that the length of a dense array is below that threshold, and also fail fast if a length that is provided obviously could not be the correct dense length (because there isn't enough data left in the buffer to populate such an array). BUG=chromium:148757 Committed: https://crrev.com/0004733c0814a5f8c5cf519a062e525dec591224 Cr-Commit-Position: refs/heads/master@{#40094}

Patch Set 1 #

Patch Set 2 : be explicit to prevent signed/unsigned comparison #

Total comments: 2

Patch Set 3 : use FixedArray::kMaxLength #

Patch Set 4 : signed/unsigned #

Unified diffs Side-by-side diffs Delta from patch set Stats (+18 lines, -1 line) Patch
M src/value-serializer.cc View 1 2 3 2 chunks +10 lines, -1 line 0 comments Download
M test/unittests/value-serializer-unittest.cc View 1 chunk +8 lines, -0 lines 0 comments Download

Messages

Total messages: 27 (19 generated)
jbroman
4 years, 2 months ago (2016-10-06 17:46:36 UTC) #10
Jakob Kummerow
lgtm https://codereview.chromium.org/2399873002/diff/20001/src/value-serializer.cc File src/value-serializer.cc (right): https://codereview.chromium.org/2399873002/diff/20001/src/value-serializer.cc#newcode26 src/value-serializer.cc:26: static const uint32_t kMaxDenseArrayLength = 0x3FFFFFFF; Why not ...
4 years, 2 months ago (2016-10-07 13:10:17 UTC) #11
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/2399873002/40001
4 years, 2 months ago (2016-10-07 15:52:08 UTC) #14
commit-bot: I haz the power
Try jobs failed on following builders: v8_linux_dbg_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_dbg_ng/builds/14186)
4 years, 2 months ago (2016-10-07 15:54:58 UTC) #16
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/2399873002/60001
4 years, 2 months ago (2016-10-07 17:51:14 UTC) #23
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 2 months ago (2016-10-07 17:53:17 UTC) #24
commit-bot: I haz the power
Patchset 4 (id:??) landed as https://crrev.com/0004733c0814a5f8c5cf519a062e525dec591224 Cr-Commit-Position: refs/heads/master@{#40094}
4 years, 2 months ago (2016-10-07 17:53:34 UTC) #26
jbroman
4 years, 2 months ago (2016-10-11 16:37:27 UTC) #27
Message was sent while issue was closed.
https://codereview.chromium.org/2399873002/diff/20001/src/value-serializer.cc
File src/value-serializer.cc (right):

https://codereview.chromium.org/2399873002/diff/20001/src/value-serializer.cc...
src/value-serializer.cc:26: static const uint32_t kMaxDenseArrayLength =
0x3FFFFFFF;
On 2016/10/07 at 13:10:17, Jakob Kummerow wrote:
> Why not FixedArray::kMaxLength?

OK, done. I have some vague unease about that value changing, but it doesn't
seem to have done so.

Powered by Google App Engine
This is Rietveld 408576698