Heap-buffer-overflow in nsPNGEncoder::ConvertHostARGBRow
Originally disclosed on Mozilla
- Fixed in 21 days
- Paid in 41 days
- Disclosed after 21 days
Created attachment 802781 Testcase
==15451==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x629000284d00 at pc 0x7ff18e8d9b57 bp 0x7ff151b414d0 sp 0x7ff151b414c8 READ of size 4 at 0x629000284d00 thread T53 #0 0x7ff18e8d9b56 in nsPNGEncoder::ConvertHostARGBRow(unsigned char const*, unsigned char*, unsigned int, bool) image/encoders/png/nsPNGEncoder.cpp:599 #1 0x7ff18e8d33df in nsPNGEncoder::AddImageFrame(unsigned char const*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, nsAString_internal const&) image/encoders/png/nsPNGEncoder.cpp:267 #2 0x7ff18e8cf9b2 in nsPNGEncoder::InitFromData(unsigned char const*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, nsAString_internal const&) image/encoders/png/nsPNGEncoder.cpp:62 #3 0x7ff1914b3e28 in mozilla::dom::ImageEncoder::GetInputStream(int, int, unsigned char*, int, imgIEncoder*, unsigned short const*, nsIInputStream**) content/canvas/src/ImageEncoder.cpp:208 #4 0x7ff1914b1230 in mozilla::dom::ImageEncoder::ExtractDataInternal(nsAString_internal const&, nsAString_internal const&, unsigned char*, int, nsIntSize, nsICanvasRenderingContextInternal*, nsIInputStream**, imgIEncoder*) content/canvas/src/ImageEncoder.cpp:240 #5 0x7ff1914b6da4 in mozilla::dom::EncodingRunnable::Run() content/canvas/src/ImageEncoder.cpp:99 #6 0x7ff19e63f95c in nsThread::ProcessNextEvent(bool, bool*) xpcom/threads/nsThread.cpp:622 #7 0x7ff19e276643 in NS_ProcessNextEvent(nsIThread*, bool) objdir-ff-asan-sym/xpcom/build/nsThreadUtils.cpp:238 #8 0x7ff19e639dfc in nsThread::ThreadFunc(void*) xpcom/threads/nsThread.cpp:250 #9 0x7ff1b1ad2d52 in _pt_root nsprpub/pr/src/pthreads/ptthread.c:204 #10 0x447693 in __asan::AsanThread::ThreadStart(unsigned long) asan_rtl #11 0x7ff1b5016e99 in start_thread #12 0x7ff1b4125ccc in 0x629000284d00 is located 0 bytes to the right of 19200-byte region [0x629000280200,0x629000284d00) allocated by thread T0 here: #0 0x440b65 in malloc asan_rtl #1 0x7ff1b540ae4a in moz_malloc memory/mozalloc/mozalloc.cpp:64 #2 0x7ff1913d5a69 in operator new[](unsigned long, mozilla::fallible_t const&) objdir-ff-asan-sym/content/canvas/src/../../../dist/include/mozilla/mozalloc.h:275 #3 0x7ff1913d5a69 in mozilla::dom::CanvasRenderingContext2D::GetImageBuffer(unsigned char**, int*) content/canvas/src/CanvasRenderingContext2D.cpp:1063 #4 0x7ff191e23e57 in mozilla::dom::HTMLCanvasElement::ToBlob(nsIFileCallback*, nsAString_internal const&, JS::Value const&, JSContext*) content/html/content/src/HTMLCanvasElement.cpp:525 #5 0x7ff19b3a0026 in mozilla::dom::HTMLCanvasElement::ToBlob(JSContext*, nsIFileCallback*, nsAString_internal const&, mozilla::dom::Optional<JS::HandleJS::Value > const&, mozilla::ErrorResult&) objdir-ff-asan-sym/dom/bindings/../../dist/include/mozilla/dom/HTMLCanvasElement.h:103 #6 0x7ff19b38fd18 in mozilla::dom::HTMLCanvasElementBinding::toBlob(JSContext*, JS::Handle<JSObject*>, mozilla::dom::HTMLCanvasElement*, JSJitMethodCallArgs const&) objdir-ff-asan-sym/dom/bindings/HTMLCanvasElementBinding.cpp:256 #7 0x7ff19b38b795 in mozilla::dom::HTMLCanvasElementBinding::genericMethod(JSContext*, unsigned int, JS::Value*) objdir-ff-asan-sym/dom/bindings/HTMLCanvasElementBinding.cpp:556 #8 0x7ff1a6f3e0c3 in js::CallJSNative(JSContext*, bool ()(JSContext, unsigned int, JS::Value*), JS::CallArgs const&) js/src/jscntxtinlines.h:219 #9 0x7ff1a6f3e0c3 in js::Invoke(JSContext*, JS::CallArgs, js::MaybeConstruct) js/src/vm/Interpreter.cpp:489 #10 0x7ff1a6f1cab1 in Interpret(JSContext*, js::RunState&) js/src/vm/Interpreter.cpp:2459 #11 0x7ff1a6ec59e3 in js::RunScript(JSContext*, js::RunState&) js/src/vm/Interpreter.cpp:446 #12 0x7ff1a6f3e742 in js::Invoke(JSContext*, JS::CallArgs, js::MaybeConstruct) js/src/vm/Interpreter.cpp:508 #13 0x7ff1a6f41b10 in js::Invoke(JSContext*, JS::Value const&, JS::Value const&, unsigned int, JS::Value*, JS::MutableHandleJS::Value) js/src/vm/Interpreter.cpp:539 #14 0x7ff1a79cf8c7 in JS_CallFunctionValue(JSContext*, JSObject*, JS::Value, unsigned int, JS::Value*, JS::Value*) js/src/jsapi.cpp:5327 #15 0x7ff19647b243 in nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS*, unsigned short, XPTMethodDescriptor const*, nsXPTCMiniVariant*) js/xpconnect/src/XPCWrappedJSClass.cpp:1445 #16 0x7ff196443d48 in nsXPCWrappedJS::CallMethod(unsigned short, XPTMethodDescriptor const*, nsXPTCMiniVariant*) js/xpconnect/src/XPCWrappedJS.cpp:587 #17 0x7ff19e796927 in PrepareAndDispatch xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp:122 #18 0x7ff19e79399a in SharedStub #19 0x7ff191c85c64 in nsEventListenerManager::HandleEventSubType(nsListenerStruct*, mozilla::dom::CallbackObjectHolder<mozilla::dom::EventListener, nsIDOMEventListener> const&, nsIDOMEvent*, mozilla::dom::EventTarget*, nsCxPusher*) content/events/src/nsEventListenerManager.cpp:962 #20 0x7ff191c877e6 in nsEventListenerManager::HandleEventInternal(nsPresContext*, nsEvent*, nsIDOMEvent**, mozilla::dom::EventTarget*, nsEventStatus*, nsCxPusher*) content/events/src/nsEventListenerManager.cpp:1033 #21 0x7ff191c71eea in nsEventListenerManager::HandleEvent(nsPresContext*, nsEvent*, nsIDOMEvent**, mozilla::dom::EventTarget*, nsEventStatus*, nsCxPusher*) content/events/src/nsEventListenerManager.h:325 #22 0x7ff191c63a86 in nsEventTargetChainItem::HandleEvent(nsEventChainPostVisitor&, ELMCreationDetector&, nsCxPusher*) content/events/src/nsEventDispatcher.cpp:189 #23 0x7ff191c5420a in nsEventTargetChainItem::HandleEventTargetChain(nsTArray<nsEventTargetChainItem>&, nsEventChainPostVisitor&, nsDispatchingCallback*, ELMCreationDetector&, nsCxPusher*) content/events/src/nsEventDispatcher.cpp:286 #24 0x7ff191c5aa7e in nsEventDispatcher::Dispatch(nsISupports*, nsPresContext*, nsEvent*, nsIDOMEvent*, nsEventStatus*, nsDispatchingCallback*, nsCOMArraymozilla::dom::EventTarget) content/events/src/nsEventDispatcher.cpp:599 #25 0x7ff191c5c33d in nsEventDispatcher::DispatchDOMEvent(nsISupports, nsEvent*, nsIDOMEvent*, nsPresContext*, nsEventStatus*) content/events/src/nsEventDispatcher.cpp:666 #26 0x7ff191035d84 in nsINode::DispatchEvent(nsIDOMEvent*, bool*) content/base/src/nsINode.cpp:1137 #27 0x7ff190ae344c in nsContentUtils::DispatchEvent(nsIDocument*, nsISupports*, nsAString_internal const&, bool, bool, bool, bool*) content/base/src/nsContentUtils.cpp:3366 #28 0x7ff190ae27a8 in nsContentUtils::DispatchTrustedEvent(nsIDocument*, nsISupports*, nsAString_internal const&, bool, bool, bool*) content/base/src/nsContentUtils.cpp:3336 #29 0x7ff190d28ec4 in nsDocument::DispatchContentLoadedEvents() content/base/src/nsDocument.cpp:4605:40 #30 0x7ff190e3ff0b in nsRunnableMethodImpl<void (nsDocument::)(), void, true>::Run() objdir-ff-asan-sym/content/base/src/../../../dist/include/nsThreadUtils.h:418 #31 0x7ff19e63f95c in nsThread::ProcessNextEvent(bool, bool) xpcom/threads/nsThread.cpp:622 Thread T53 created by T0 here: #0 0x431fd1 in __interceptor_pthread_create asan_rtl #1 0x7ff1b1ac4644 in _PR_CreateThread nsprpub/pr/src/pthreads/ptthread.c:444 #2 0x7ff1b1ac2a1a in PR_CreateThread nsprpub/pr/src/pthreads/ptthread.c:527 #3 0x7ff19e63c2de in nsThread::Init() xpcom/threads/nsThread.cpp:316 #4 0x7ff19e65765d in nsThreadManager::NewThread(unsigned int, unsigned int, nsIThread**) xpcom/threads/nsThreadManager.cpp:214 #5 0x7ff19e274201 in NS_NewThread(nsIThread**, nsIRunnable*, unsigned int) objdir-ff-asan-sym/xpcom/build/nsThreadUtils.cpp:67 #6 0x7ff1914b2b65 in mozilla::dom::ImageEncoder::ExtractDataAsync(nsAString_internal&, nsAString_internal const&, bool, unsigned char*, int, nsIntSize, nsICanvasRenderingContextInternal*, JSContext*, nsIFileCallback*) content/canvas/src/ImageEncoder.cpp:180 #7 0x7ff191e240b2 in mozilla::dom::HTMLCanvasElement::ToBlob(nsIFileCallback*, nsAString_internal const&, JS::Value const&, JSContext*) content/html/content/src/HTMLCanvasElement.cpp:534 #8 0x7ff19b3a0026 in mozilla::dom::HTMLCanvasElement::ToBlob(JSContext*, nsIFileCallback*, nsAString_internal const&, mozilla::dom::Optional<JS::HandleJS::Value > const&, mozilla::ErrorResult&) objdir-ff-asan-sym/dom/bindings/../../dist/include/mozilla/dom/HTMLCanvasElement.h:103 #9 0x7ff19b38fd18 in mozilla::dom::HTMLCanvasElementBinding::toBlob(JSContext*, JS::Handle<JSObject*>, mozilla::dom::HTMLCanvasElement*, JSJitMethodCallArgs const&) objdir-ff-asan-sym/dom/bindings/HTMLCanvasElementBinding.cpp:256 #10 0x7ff19b38b795 in mozilla::dom::HTMLCanvasElementBinding::genericMethod(JSContext*, unsigned int, JS::Value*) objdir-ff-asan-sym/dom/bindings/HTMLCanvasElementBinding.cpp:556 #11 0x7ff1a6f3e0c3 in js::CallJSNative(JSContext*, bool ()(JSContext, unsigned int, JS::Value*), JS::CallArgs const&) js/src/jscntxtinlines.h:219 #12 0x7ff1a6f3e0c3 in js::Invoke(JSContext*, JS::CallArgs, js::MaybeConstruct) js/src/vm/Interpreter.cpp:489 #13 0x7ff1a6f1cab1 in Interpret(JSContext*, js::RunState&) js/src/vm/Interpreter.cpp:2459 #14 0x7ff1a6ec59e3 in js::RunScript(JSContext*, js::RunState&) js/src/vm/Interpreter.cpp:446 #15 0x7ff1a6f3e742 in js::Invoke(JSContext*, JS::CallArgs, js::MaybeConstruct) js/src/vm/Interpreter.cpp:508 #16 0x7ff1a6f41b10 in js::Invoke(JSContext*, JS::Value const&, JS::Value const&, unsigned int, JS::Value*, JS::MutableHandleJS::Value) js/src/vm/Interpreter.cpp:539 #17 0x7ff1a79cf8c7 in JS_CallFunctionValue(JSContext*, JSObject*, JS::Value, unsigned int, JS::Value*, JS::Value*) js/src/jsapi.cpp:5327 #18 0x7ff19647b243 in nsXPCWrappedJSClass::CallMethod(nsXPCWrappedJS*, unsigned short, XPTMethodDescriptor const*, nsXPTCMiniVariant*) js/xpconnect/src/XPCWrappedJSClass.cpp:1445 #19 0x7ff196443d48 in nsXPCWrappedJS::CallMethod(unsigned short, XPTMethodDescriptor const*, nsXPTCMiniVariant*) js/xpconnect/src/XPCWrappedJS.cpp:587 #20 0x7ff19e796927 in PrepareAndDispatch xpcom/reflect/xptcall/src/md/unix/xptcstubs_x86_64_linux.cpp:122 #21 0x7ff19e79399a in SharedStub #22 0x7ff191c85c64 in nsEventListenerManager::HandleEventSubType(nsListenerStruct*, mozilla::dom::CallbackObjectHolder<mozilla::dom::EventListener, nsIDOMEventListener> const&, nsIDOMEvent*, mozilla::dom::EventTarget*, nsCxPusher*) content/events/src/nsEventListenerManager.cpp:962 #23 0x7ff191c877e6 in nsEventListenerManager::HandleEventInternal(nsPresContext*, nsEvent*, nsIDOMEvent**, mozilla::dom::EventTarget*, nsEventStatus*, nsCxPusher*) content/events/src/nsEventListenerManager.cpp:1033 #24 0x7ff191c71eea in nsEventListenerManager::HandleEvent(nsPresContext*, nsEvent*, nsIDOMEvent**, mozilla::dom::EventTarget*, nsEventStatus*, nsCxPusher*) content/events/src/nsEventListenerManager.h:325 #25 0x7ff191c63a86 in nsEventTargetChainItem::HandleEvent(nsEventChainPostVisitor&, ELMCreationDetector&, nsCxPusher*) content/events/src/nsEventDispatcher.cpp:189 #26 0x7ff191c5420a in nsEventTargetChainItem::HandleEventTargetChain(nsTArray<nsEventTargetChainItem>&, nsEventChainPostVisitor&, nsDispatchingCallback*, ELMCreationDetector&, nsCxPusher*) content/events/src/nsEventDispatcher.cpp:286 #27 0x7ff191c5aa7e in nsEventDispatcher::Dispatch(nsISupports*, nsPresContext*, nsEvent*, nsIDOMEvent*, nsEventStatus*, nsDispatchingCallback*, nsCOMArraymozilla::dom::EventTarget) content/events/src/nsEventDispatcher.cpp:599 #28 0x7ff191c5c33d in nsEventDispatcher::DispatchDOMEvent(nsISupports, nsEvent*, nsIDOMEvent*, nsPresContext*, nsEventStatus*) content/events/src/nsEventDispatcher.cpp:666 #29 0x7ff191035d84 in nsINode::DispatchEvent(nsIDOMEvent*, bool*) content/base/src/nsINode.cpp:1137 #30 0x7ff190ae344c in nsContentUtils::DispatchEvent(nsIDocument*, nsISupports*, nsAString_internal const&, bool, bool, bool, bool*) content/base/src/nsContentUtils.cpp:3366 #31 0x7ff190ae27a8 in nsContentUtils::DispatchTrustedEvent(nsIDocument*, nsISupports*, nsAString_internal const&, bool, bool, bool*) content/base/src/nsContentUtils.cpp:3336 #32 0x7ff190d28ec4 in nsDocument::DispatchContentLoadedEvents() content/base/src/nsDocument.cpp:4605:40 #33 0x7ff190e3ff0b in nsRunnableMethodImpl<void (nsDocument::)(), void, true>::Run() objdir-ff-asan-sym/content/base/src/../../../dist/include/nsThreadUtils.h:418 #34 0x7ff19e63f95c in nsThread::ProcessNextEvent(bool, bool) xpcom/threads/nsThread.cpp:622 #35 0x7ff19e276643 in NS_ProcessNextEvent(nsIThread*, bool) objdir-ff-asan-sym/xpcom/build/nsThreadUtils.cpp:238 #36 0x7ff198eaf9b8 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) ipc/glue/MessagePump.cpp:81 #37 0x7ff19eb8b7a7 in MessageLoop::RunInternal() ipc/chromium/src/base/message_loop.cc:220 #38 0x7ff19eb8b3fa in MessageLoop::RunHandler() ipc/chromium/src/base/message_loop.cc:213 #39 0x7ff19eb8b2d5 in MessageLoop::Run() ipc/chromium/src/base/message_loop.cc:187 #40 0x7ff1985e6d6f in nsBaseAppShell::Run() widget/xpwidgets/nsBaseAppShell.cpp:161 #41 0x7ff196f5163f in nsAppStartup::Run() toolkit/components/startup/nsAppStartup.cpp:269 #42 0x7ff18c0a6791 in XREMain::XRE_mainRun() toolkit/xre/nsAppRunner.cpp:3869 #43 0x7ff18c0a960a in XREMain::XRE_main(int, char**, nsXREAppData const*) toolkit/xre/nsAppRunner.cpp:3937 #44 0x7ff18c0aba94 in XRE_main toolkit/xre/nsAppRunner.cpp:4139 #45 0x457257 in do_main(int, char**, nsIFile*) browser/app/nsBrowserApp.cpp:275 #46 0x454385 in main browser/app/nsBrowserApp.cpp:635 #47 0x7ff1b405376c in Shadow bytes around the buggy address: 0x0c5280048950: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c5280048960: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c5280048970: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c5280048980: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c5280048990: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0c52800489a0:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c52800489b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c52800489c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c52800489d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c52800489e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0c52800489f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 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 ==15451==ABORTING
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is known
A critical-severity memory corruption bug in Graphics: ImageLib. Mozilla made it public on 2 October 2013.
About Memory corruption
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.