Bug 216904

Summary: %ArrayIteratorPrototype%.next must check for detached buffers
Product: WebKit Reporter: Ross Kirsling <ross.kirsling>
Component: New BugsAssignee: Ross Kirsling <ross.kirsling>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, joepeck, keith_miller, mark.lam, msaboff, saam, tzagallo, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Ross Kirsling 2020-09-23 16:00:46 PDT
%ArrayIteratorPrototype%.next must check for detached buffers
Comment 1 Ross Kirsling 2020-09-23 16:05:30 PDT
Created attachment 409513 [details]
Patch
Comment 2 Yusuke Suzuki 2020-09-23 16:31:55 PDT
Comment on attachment 409513 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=409513&action=review

> Source/JavaScriptCore/builtins/ArrayIteratorPrototype.js:37
> +    if (@isTypedArrayView(array) && @isNeutered(array))
> +        @throwTypeError("Underlying ArrayBuffer has been detached from the view");
> +

JSC has fast path for array iteration in all tiers. Can you check whether this is correctly handled in this iteration protocol?
For example, DFG has inlined DFG codes for this next function in DFGByteCodeParser.
Comment 3 Ross Kirsling 2020-09-23 18:47:04 PDT
Created attachment 409521 [details]
Patch
Comment 4 Ross Kirsling 2020-09-23 18:48:12 PDT
(In reply to Yusuke Suzuki from comment #2)
> Comment on attachment 409513 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=409513&action=review
> 
> > Source/JavaScriptCore/builtins/ArrayIteratorPrototype.js:37
> > +    if (@isTypedArrayView(array) && @isNeutered(array))
> > +        @throwTypeError("Underlying ArrayBuffer has been detached from the view");
> > +
> 
> JSC has fast path for array iteration in all tiers. Can you check whether
> this is correctly handled in this iteration protocol?
> For example, DFG has inlined DFG codes for this next function in
> DFGByteCodeParser.

Seems like this isn't an issue after all, but I've added a test to demonstrate / ensure it.
Comment 5 EWS 2020-09-23 23:15:40 PDT
Committed r267519: <https://trac.webkit.org/changeset/267519>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 409521 [details].
Comment 6 Radar WebKit Bug Importer 2020-09-23 23:16:19 PDT
<rdar://problem/69482891>