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

Issue 1526183004: Prevent SharedArrayBuffer views from being used in bindings (Closed)

Created:
5 years ago by binji
Modified:
3 years, 11 months ago
Reviewers:
esprehn, jbroman
CC:
blink-reviews, blink-reviews-bindings_chromium.org, blink-reviews-dom_chromium.org, chromium-reviews, dglazkov+blink, eae+blinkwatch, rwlbuis, sof
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Prevent SharedArrayBuffer views from being used in bindings This CL adds a check to any API that takes an ArrayBufferView. This check ensures that isShared() returns false, so the function cannot be used with an ArrayBufferView that is backed by a SharedArrayBuffer. Currently, all APIs match three cases: 1. Taking an ArrayBufferView (or derived type or typedef) directly: ImageData(UInt8ClampedArray, ...) 2. Taking a union type where one type is an ArrayBufferView: FontFace(DOMString, (DOMString or ArrayBuffer or ArrayBufferView), ...); 3. Taking a sequence of union type where one type is an ArrayBuffeView: Blob(sequence<(ArrayBuffer or ArrayBufferView or Blob or DOMString)>, ...); If a new pattern is introduced, it will raise an exception in the bindings generator. This will prevent us from accidentally allowing SharedArrayBuffer views for these new functions. BUG=569681

Patch Set 1 #

Patch Set 2 : rebase master #

Patch Set 3 : add ArrayBufferOrArrayBufferView #

Patch Set 4 : some tests #

Unified diffs Side-by-side diffs Delta from patch set Stats (+677 lines, -6 lines) Patch
M third_party/WebKit/LayoutTests/VirtualTestSuites View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/fast/canvas/resources/canvas-ImageData.js View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/css/fontface-arraybuffer.html View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix.html View 1 2 3 1 chunk +13 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-readonly.html View 1 2 3 1 chunk +13 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/files/blob-constructor.html View 1 2 3 1 chunk +13 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/files/file-constructor.html View 1 2 3 1 chunk +13 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/fast/README.txt View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/fast/canvas/canvas-ImageData-constructor-expected.txt View 1 2 3 1 chunk +46 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/fast/css/fontface-arraybuffer-expected.txt View 1 2 3 1 chunk +18 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/fast/files/blob-constructor-expected.txt View 1 2 3 1 chunk +100 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/fast/files/file-constructor-expected.txt View 1 2 3 1 chunk +112 lines, -0 lines 0 comments Download
D third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/fast/workers/README.txt View 1 2 3 1 chunk +0 lines, -5 lines 0 comments Download
A third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/fast/xmlhttprequest/xmlhttprequest-send-sharedarraybuffer.html View 1 2 3 1 chunk +14 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/fast/xmlhttprequest/xmlhttprequest-send-sharedarraybuffer-expected.txt View 1 2 3 1 chunk +9 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/scripts/v8_methods.py View 1 2 chunks +28 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/scripts/v8_types.py View 1 1 chunk +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl View 1 2 3 1 chunk +24 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/idls/core/TestObject.idl View 1 1 chunk +1 line, -0 lines 0 comments Download
A third_party/WebKit/Source/bindings/tests/results/core/ArrayBufferOrArrayBufferView.h View 1 2 1 chunk +86 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/bindings/tests/results/core/ArrayBufferOrArrayBufferView.cpp View 1 2 1 chunk +108 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp View 1 2 3 11 chunks +62 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/dom/FlexibleArrayBufferView.h View 1 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 21 (11 generated)
binji
Still adding some more tests, but wanted to see if this made sense, or if ...
3 years, 11 months ago (2017-01-19 03:23:42 UTC) #10
esprehn
Can we introduce two subclasses instead? I'm weary of where we're ending up with the ...
3 years, 11 months ago (2017-01-19 03:54:04 UTC) #12
binji
On 2017/01/19 03:54:04, esprehn wrote: > Can we introduce two subclasses instead? I'm weary of ...
3 years, 11 months ago (2017-01-19 18:44:28 UTC) #13
jbroman
Have the standards folk talked about the right way to handle this? - I could ...
3 years, 11 months ago (2017-01-19 18:47:30 UTC) #14
binji
On 2017/01/19 18:47:30, jbroman wrote: > Have the standards folk talked about the right way ...
3 years, 11 months ago (2017-01-19 18:53:10 UTC) #15
binji
On 2017/01/19 18:53:10, binji wrote: > On 2017/01/19 18:47:30, jbroman wrote: > > Have the ...
3 years, 11 months ago (2017-01-19 18:56:08 UTC) #17
domenic
The standards plan is to create a Web IDL mechanism for opting in. Currently the ...
3 years, 11 months ago (2017-01-19 20:42:26 UTC) #18
jbroman
OK. That's approximately (but not quite?) what this CL does. Is FlexibleArrayBufferView the same thing ...
3 years, 11 months ago (2017-01-19 21:47:33 UTC) #19
binji
> This CL also doesn't seem to look at dictionaries, but (for example) > MIDIMessageEventInit ...
3 years, 11 months ago (2017-01-20 00:20:16 UTC) #20
binji
3 years, 11 months ago (2017-01-26 01:45:23 UTC) #21
On 2017/01/20 00:20:16, binji wrote:
> > This CL also doesn't seem to look at dictionaries, but (for example)
> > MIDIMessageEventInit would seem to suffer from the same issue. There's an
> > allusion to it in the thread dominic linked (#18), but I don't see it
> mentioned
> > in this CL or the attached bug.
> 
> You're right, I just missed this case. I was hoping that has_array_buffer_view
> would catch cases like this, but it looks like dictionaries are handled
> specially.

I discussed this with esprehn@, and we agreed that it would be better to use the
C++ type system to catch these cases, rather than the binding system.

Powered by Google App Engine
This is Rietveld 408576698