This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25672 - Need to define what happens when putImageData is passed an ImageData whose .data's ArrayBuffer has been neutered
Summary: Need to define what happens when putImageData is passed an ImageData whose .d...
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-12 23:55 UTC by contributor
Modified: 2014-05-15 18:40 UTC (History)
3 users (show)

See Also:


Attachments

Description contributor 2014-05-12 23:55:44 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html
Multipage: http://www.whatwg.org/C#dom-context-2d-putimagedata
Complete: http://www.whatwg.org/c#dom-context-2d-putimagedata
Referrer: http://www.whatwg.org/specs/web-apps/current-work/multipage/

Comment:
Need to define what happens when putImageData is passed an ImageData whose
.data's ArrayBuffer has been neutered

Posted from: 63.245.221.34 by bzbarsky@mit.edu
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:32.0) Gecko/20100101 Firefox/32.0
Comment 1 Boris Zbarsky 2014-05-12 23:58:32 UTC
In particular, putImageData seems to assume that the width and height of the ImageData argument determine how much data is available (in particular, that there are width*height*4 bytes of data), but if the ArrayBuffer as been neutered that's just not the case.

This is not handled by the behavior ES6 defines for neutered ArrayBuffers, because the only spec text here is:

  copy the four channels of the pixel with coordinate (x, y) in the imagedata
  data structure to the pixel with coordinate (dx+x, dy+y)

which doesn't actually define how the "four channels of the pixel" are extracted from the ImageData...
Comment 2 Ian 'Hixie' Hickson 2014-05-13 18:33:49 UTC
That text is referencing the earlier text definign "a Canvas Pixel ArrayBuffer". I've tried to make that mildly clearer.

But yeah, either way neutered ImageData data isn't mentioned.

I've updated putImageData() and createImageBitmap() to throw in this particular situation. I left the createImageData() method that takes an ImageData alone since it doesn't actually reference the data.
Comment 3 contributor 2014-05-13 18:39:43 UTC
Checked in as WHATWG revision r8629.
Check-in comment: Define how to handle neutered ImageData objects
http://html5.org/tools/web-apps-tracker?from=8628&to=8629
Comment 4 Boris Zbarsky 2014-05-13 18:43:09 UTC
Thanks!

"A Canvas Pixel ArrayBuffer is an ArrayBuffer that whose data " has a stray "that", I think.
Comment 5 Ian 'Hixie' Hickson 2014-05-15 18:39:52 UTC
Oops. Thanks. Fixed.
Comment 6 contributor 2014-05-15 18:40:20 UTC
Checked in as WHATWG revision r8637.
Check-in comment: Typo in canvas section
http://html5.org/tools/web-apps-tracker?from=8636&to=8637