Infinite Canvas context save() causes WebKit to crash
https://bugs.webkit.org/show_bug.cgi?id=159586
<rdar://problem/26759984>
Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2016-07-26
Reviewed by Simon Fraser.
Source/WebCore:
Limit the size of the canvas context state stack to 1024 * 16 saves. All
the saves which come after that limit will stay unrealized. The restore()
should not have any effect till there is no unrealized saves.
Test: fast/canvas/canvas-context-save-limit.html
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::realizeSaves):
(WebCore::CanvasRenderingContext2D::realizeSavesLoop):
* html/canvas/CanvasRenderingContext2D.h:
LayoutTests:
* fast/canvas/canvas-context-save-limit-expected.txt: Added.
* fast/canvas/canvas-context-save-limit.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@203729 268f45cc-cd09-0410-ab3c-d52691b4dbfc
6 files changed