ArrayBuffer neutering

Allen Wirfs-Brock allen at wirfs-brock.com
Thu May 22 10:54:06 PDT 2014


On May 22, 2014, at 9:28 AM, Boris Zbarsky wrote:

> On 5/22/14, 12:16 PM, Allen Wirfs-Brock wrote:
>> Out-of-bounds access have also been observed in non-Emscripten code, for
>> example [1] [2].
> 
> Out-of-bounds reads are very common in code that works with canvas imagedata, because a lot of image-processing algorithms want to examine adjacent pixels, and when you get to the end you end up outside the array.  Making out-of-bounds access throw on non-neutered Uint32ClampedArray is a non-starter, imo.

I can believe it.  Although I suspect a lot of those image-process algorithms were originally expressed in C code where hopefully they weren't dong out-of bounds accesses.

> 
>> It's still early days for production use of TypedArrays
> 
> Uh... No, it's not.  They've been shipping for years and people are using them all over, as far as I can tell.
> 
>> and maybe its not too late to evangelize fixing any major apps that depend upon
>> out-of-bounds accesses or accessed to neutered arrays.
> 
> Neutering is more recent, so I can't speak to compat issues for neutered arrays with certainty.  I can say with certainty that out-of-bounds reads on Uint8ClampedArray can't change their behavior.

I'd be reasonably content if we could make accesses to neutered arrays throw and keep undefined as the result of out-of-bounds accesses for non-neutered typed arrays.

Allen


More information about the es-discuss mailing list