⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 215632 in webkit


Ignore:
Timestamp:
Apr 21, 2017, 1:07:07 PM (9 years ago)
Author:
Brent Fulgham
Message:

Validate vImage arguments
https://bugs.webkit.org/show_bug.cgi?id=171109
Source/WebCore:

rdar://problem/30236606

Patch by Per Arne Vollan <pvollan@apple.com> on 2017-04-21
Reviewed by Brent Fulgham.

When writing data to a canvas context, clip the source rectangle to the data rectangle
to make sure we will not attempt to read data outside of the buffer.

Test: fast/canvas/canvas-crash.html

  • html/canvas/CanvasRenderingContext2D.cpp:

(WebCore::CanvasRenderingContext2D::putImageData):

LayoutTests:

Patch by Per Arne Vollan <pvollan@apple.com> on 2017-04-21
Reviewed by Brent Fulgham.

  • fast/canvas/canvas-crash-expected.txt: Added.
  • fast/canvas/canvas-crash.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r215622 r215632  
     12017-04-21  Per Arne Vollan  <pvollan@apple.com>
     2
     3        Validate vImage arguments
     4        https://bugs.webkit.org/show_bug.cgi?id=171109
     5
     6        Reviewed by Brent Fulgham.
     7
     8        * fast/canvas/canvas-crash-expected.txt: Added.
     9        * fast/canvas/canvas-crash.html: Added.
     10
    1112017-04-21  Ryan Haddad  <ryanhaddad@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r215629 r215632  
     12017-04-21  Per Arne Vollan  <pvollan@apple.com>
     2
     3        Validate vImage arguments
     4        https://bugs.webkit.org/show_bug.cgi?id=171109
     5        rdar://problem/30236606
     6
     7        Reviewed by Brent Fulgham.
     8
     9        When writing data to a canvas context, clip the source rectangle to the data rectangle
     10        to make sure we will not attempt to read data outside of the buffer.
     11
     12        Test: fast/canvas/canvas-crash.html
     13
     14        * html/canvas/CanvasRenderingContext2D.cpp:
     15        (WebCore::CanvasRenderingContext2D::putImageData):
     16
    1172017-04-21  David Kilzer  <ddkilzer@apple.com>
    218
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp

    r215069 r215632  
    20882088    IntRect sourceRect(destRect);
    20892089    sourceRect.move(-destOffset);
    2090 
    2091     buffer->putByteArray(Unmultiplied, data.data(), IntSize(data.width(), data.height()), sourceRect, IntPoint(destOffset), coordinateSystem);
     2090    sourceRect.intersect(IntRect(0, 0, data.width(), data.height()));
     2091
     2092    if (!sourceRect.isEmpty())
     2093        buffer->putByteArray(Unmultiplied, data.data(), IntSize(data.width(), data.height()), sourceRect, IntPoint(destOffset), coordinateSystem);
    20922094
    20932095    didDraw(destRect, CanvasDidDrawApplyNone); // ignore transform, shadow and clip
Note: See TracChangeset for help on using the changeset viewer.