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

Issue 23003021: WebCrypto: assert that WebArrayBuffers are not null. (Closed)

Created:
7 years, 4 months ago by eroman
Modified:
7 years, 4 months ago
Reviewers:
abarth-chromium
CC:
blink-reviews, eae+blinkwatch, tommyw+watchlist_chromium.org, jeez, dglazkov+blink
Visibility:
Public.

Description

WebCrypto: assert that WebArrayBuffers are not null. This is a defensive check in case the platform layer passes in a bogus WebArrayBuffer. It is possible to create a null WebArrayBuffer by making its byte size exceed 2^32. For instance "WebArrayBuffer::create(0xFFFFFFFF, 8)" BUG=245025 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=156578

Patch Set 1 #

Patch Set 2 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -0 lines) Patch
M Source/core/platform/chromium/support/WebCrypto.cpp View 1 2 chunks +2 lines, -0 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
eroman
7 years, 4 months ago (2013-08-22 03:17:26 UTC) #1
abarth-chromium
> WebArrayBuffer::create(0xFFFFFFFF, 8) That doesn't just crash?
7 years, 4 months ago (2013-08-22 18:44:09 UTC) #2
abarth-chromium
lgtm
7 years, 4 months ago (2013-08-22 18:44:13 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/eroman@chromium.org/23003021/3001
7 years, 4 months ago (2013-08-22 18:57:41 UTC) #4
commit-bot: I haz the power
Change committed as 156578
7 years, 4 months ago (2013-08-22 21:06:34 UTC) #5
eroman
7 years, 4 months ago (2013-08-22 21:33:13 UTC) #6
WebArrayBuffer::create() can fail creation and return NULL data, meaning
consumers need to test it before using it.

The only case I could find where this happens is when the requested data is
larger than 2^23 (possible because the size is specified as number of
elements rather than number of bytes).

Source:
https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit...

I decided to add some defensive checks to avoid operating on the NULL
buffer later.
Conceptually I see it as an error on the part of the caller.



On Thu, Aug 22, 2013 at 11:44 AM, <abarth@chromium.org> wrote:

> WebArrayBuffer::create(**0xFFFFFFFF, 8)
>>
>
> That doesn't just crash?
>
>
https://codereview.chromium.**org/23003021/<https://codereview.chromium.org/2...
>

To unsubscribe from this group and stop receiving emails from it, send an email
to blink-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698