Changeset 182750 in webkit
- Timestamp:
- Apr 13, 2015 12:53:14 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r182748 r182750 1 2015-04-13 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Canvas drawImage() has a security hole when the image isn't yet fully loaded. 4 https://bugs.webkit.org/show_bug.cgi?id=58681. 5 6 Reviewed by Darin Adler. 7 8 This test confirms when we load an image from a different origin and try 9 drawing it on a canvas, the canvas is tainted if the image is completely 10 loaded and drawn. Otherwise the image is not drawn. 11 12 * http/tests/canvas/canvas-tainted-after-draw-image-expected.txt: Added. 13 * http/tests/canvas/canvas-tainted-after-draw-image.html: Added. 14 * http/tests/canvas/resources: Added. 15 * http/tests/canvas/resources/100x100-lime-rect.svg: Added. 16 1 17 2015-04-13 Beth Dakin <bdakin@apple.com> 2 18 -
trunk/Source/WebCore/ChangeLog
r182748 r182750 1 2015-04-13 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Canvas drawImage() has a security hole when the image isn't yet fully loaded. 4 https://bugs.webkit.org/show_bug.cgi?id=58681. 5 6 Reviewed by Darin Adler. 7 8 There is a race condition which may happen if an image from a different 9 origin is drawn on a canvas before it finishes loading. The check to taint 10 the canvas comes before drawing it. This check returns false if the image 11 is not completely loaded because we check the URL of the resource response. 12 If after this check and before the drawing, the image finishes loading, the 13 canvas will not be tainted but the image will be drawn. 14 15 The fix is to move the check to taint the canvas after drawing the image. 16 The only problem with this solution is basically the opposite of this bug: 17 we will become stricter than before with images which are from a different 18 origin and before they finish loading. The image has not finished loading, 19 so we do not draw it. Before we check for tainting, the image finishes 20 loading. So we decide to taint the canvas even the image is not drawn. 21 22 But this should not be a security issue anymore. I personally do not know 23 if it is even a correctness issue or not. 24 25 Test: http/tests/canvas/canvas-tainted-after-draw-image.html 26 27 * html/canvas/CanvasRenderingContext2D.cpp: 28 (WebCore::CanvasRenderingContext2D::drawImage): 29 1 30 2015-04-13 Beth Dakin <bdakin@apple.com> 2 31 -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r182207 r182750 1378 1378 return; 1379 1379 1380 checkOrigin(image);1381 1382 1380 if (rectContainsCanvas(normalizedDstRect)) { 1383 1381 c->drawImage(cachedImage->imageForRenderer(image->renderer()), ColorSpaceDeviceRGB, normalizedDstRect, normalizedSrcRect, ImagePaintingOptions(op, blendMode)); … … 1394 1392 didDraw(normalizedDstRect); 1395 1393 } 1394 1395 checkOrigin(image); 1396 1396 } 1397 1397
Note: See TracChangeset
for help on using the changeset viewer.