Skip to content
Memory corruption Disclosed report CVE-2015-4512

AddressSanitizer READ of size 1364 gfx/2d/DataSurfaceHelpers.cpp:81

Francisco A Follow

Originally disclosed on Mozilla

  • Fixed in 42 days
  • Paid in 49 days
  • Disclosed after 42 days

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36

Steps to reproduce:

Version: firefox-41.0a1.en-US.linux-x86_64-asan (latest Mozilla ASAN build) OS: Ubuntu 15.04

Actual results:

================================================================= ==25926==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f9b380986a7 at pc 0x7f9b5a205a94 bp 0x7fffa3c79bb0 sp 0x7fffa3c79ba8 READ of size 1364 at 0x7f9b380986a7 thread T0 (Web Content) #0 0x7f9b5a205a93 in mozilla::gfx::CopySurfaceDataToPackedArray(unsigned char*, unsigned char*, mozilla::gfx::IntSizeTypedmozilla::gfx::UnknownUnits, int, int) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/gfx/2d/DataSurfaceHelpers.cpp:81 #1 0x7f9b5a205cf3 in mozilla::gfx::SurfaceToPackedBGRA(mozilla::gfx::DataSourceSurface*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/gfx/2d/DataSurfaceHelpers.cpp:132 #2 0x7f9b5be43519 in mozilla::dom::CanvasRenderingContext2D::GetImageBuffer(unsigned char**, int*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/dom/canvas/CanvasRenderingContext2D.cpp:1597 #3 0x7f9b5c104cee in mozilla::dom::HTMLCanvasElement::ToBlob(JSContext*, mozilla::dom::FileCallback&, nsAString_internal const&, JS::HandleJS::Value, mozilla::ErrorResult&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/dom/html/HTMLCanvasElement.cpp:594 #4 0x7f9b5bb7f32b in mozilla::dom::HTMLCanvasElementBinding::toBlob(JSContext*, JS::Handle<JSObject*>, mozilla::dom::HTMLCanvasElement*, JSJitMethodCallArgs const&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/obj-firefox/dom/bindings/./HTMLCanvasElementBinding.cpp:345 #5 0x7f9b5bdbeb56 in mozilla::dom::GenericBindingMethod(JSContext*, unsigned int, JS::Value*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/dom/bindings/BindingUtils.cpp:2609 #6 0x7f9b5f7f8ff2 in js::CallJSNative(JSContext*, bool ()(JSContext, unsigned int, JS::Value*), JS::CallArgs const&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/js/src/jscntxtinlines.h:235 #7 0x7f9b5f7bbe82 in js::Invoke(JSContext*, JS::CallArgs, js::MaybeConstruct) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/js/src/vm/Interpreter.cpp:720:16 #8 0x7f9b5f7eac5e in Interpret(JSContext*, js::RunState&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/js/src/vm/Interpreter.cpp:2961 #9 0x7f9b5f7d7fcb in js::RunScript(JSContext*, js::RunState&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/js/src/vm/Interpreter.cpp:677 #10 0x7f9b5f7bbfe5 in js::Invoke(JSContext*, JS::CallArgs, js::MaybeConstruct) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/js/src/vm/Interpreter.cpp:747 #11 0x7f9b5f785ae4 in js::Invoke(JSContext*, JS::Value const&, JS::Value const&, unsigned int, JS::Value const*, JS::MutableHandleJS::Value) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/js/src/vm/Interpreter.cpp:784 #12 0x7f9b600720a2 in JS_CallFunctionValue(JSContext*, JS::Handle<JSObject*>, JS::HandleJS::Value, JS::HandleValueArray const&, JS::MutableHandleJS::Value) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/js/src/jsapi.cpp:4392 #13 0x7f9b5a788456 in nsFrameMessageManager::ReceiveMessage(nsISupports*, nsIFrameLoader*, bool, nsAString_internal const&, bool, mozilla::dom::StructuredCloneData const*, mozilla::jsipc::CpowHolder*, nsIPrincipal*, nsTArraymozilla::OwningSerializedStructuredCloneBuffer) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/dom/base/nsFrameMessageManager.cpp:1253 #14 0x7f9b5a7873cc in nsFrameMessageManager::ReceiveMessage(nsISupports, nsIFrameLoader*, nsAString_internal const&, bool, mozilla::dom::StructuredCloneData const*, mozilla::jsipc::CpowHolder*, nsIPrincipal*, nsTArraymozilla::OwningSerializedStructuredCloneBuffer) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/dom/base/nsFrameMessageManager.cpp:1070 #15 0x7f9b5caa5ead in mozilla::dom::TabChild::RecvAsyncMessage(nsString const&, mozilla::dom::ClonedMessageData const&, nsTArraymozilla::jsipc::CpowEntry&&, IPC::Principal const&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/dom/ipc/TabChild.cpp:2738 #16 0x7f9b5caa5f4f in non-virtual thunk to mozilla::dom::TabChild::RecvAsyncMessage(nsString const&, mozilla::dom::ClonedMessageData const&, nsTArraymozilla::jsipc::CpowEntry&&, IPC::Principal const&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/obj-firefox/dom/ipc/Unified_cpp_dom_ipc0.cpp:2742 #17 0x7f9b599d6971 in mozilla::dom::PBrowserChild::OnMessageReceived(IPC::Message const&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/obj-firefox/ipc/ipdl/./PBrowserChild.cpp:2547 #18 0x7f9b59ad4f7a in mozilla::dom::PContentChild::OnMessageReceived(IPC::Message const&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/obj-firefox/ipc/ipdl/./PContentChild.cpp:5316 #19 0x7f9b595965a0 in mozilla::ipc::MessageChannel::DispatchAsyncMessage(IPC::Message const&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/glue/MessageChannel.cpp:1279 #20 0x7f9b59594e63 in mozilla::ipc::MessageChannel::DispatchMessage(IPC::Message const&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/glue/MessageChannel.cpp:1198 #21 0x7f9b5958c63c in mozilla::ipc::MessageChannel::OnMaybeDequeueOne() /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/glue/MessageChannel.cpp:1182 #22 0x7f9b59513661 in MessageLoop::RunTask(Task) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/chromium/src/base/message_loop.cc:361 #23 0x7f9b595140df in MessageLoop::DeferOrRunPendingTask(MessageLoop::PendingTask const&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/chromium/src/base/message_loop.cc:369 #24 0x7f9b595146ba in MessageLoop::DoWork() /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/chromium/src/base/message_loop.cc:456 #25 0x7f9b5959c237 in mozilla::ipc::DoWorkRunnable::Run() /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/glue/MessagePump.cpp:220 #26 0x7f9b58dc392a in nsThread::ProcessNextEvent(bool, bool*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/xpcom/threads/nsThread.cpp:846 #27 0x7f9b58e424de in NS_ProcessNextEvent(nsIThread*, bool) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/xpcom/glue/nsThreadUtils.cpp:265 #28 0x7f9b5959b8bc in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/glue/MessagePump.cpp:127 #29 0x7f9b5959c680 in mozilla::ipc::MessagePumpForChildProcess::Run(base::MessagePump::Delegate*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/glue/MessagePump.cpp:289 #30 0x7f9b59513321 in MessageLoop::RunInternal() /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/chromium/src/base/message_loop.cc:233 #31 0x7f9b595131c8 in MessageLoop::Run() /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/chromium/src/base/message_loop.cc:200 #32 0x7f9b5cea8566 in nsBaseAppShell::Run() /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/widget/nsBaseAppShell.cpp:165 #33 0x7f9b5e4956a6 in XRE_RunAppShell /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/toolkit/xre/nsEmbedFunctions.cpp:745 #34 0x7f9b5959c518 in mozilla::ipc::MessagePumpForChildProcess::Run(base::MessagePump::Delegate*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/glue/MessagePump.cpp:259 #35 0x7f9b59513321 in MessageLoop::RunInternal() /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/chromium/src/base/message_loop.cc:233 #36 0x7f9b595131c8 in MessageLoop::Run() /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/chromium/src/base/message_loop.cc:200 #37 0x7f9b5e494a90 in XRE_InitChildProcess /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/toolkit/xre/nsEmbedFunctions.cpp:581 #38 0x49c779 in content_process_main(int, char**) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/app/../contentproc/plugin-container.cpp:236 #39 0x7f9b55dc8a3f in __libc_start_main /build/buildd/glibc-2.21/csu/libc-start.c:289 #40 0x49ba3c in _start (/home/revskills/Browsers/firefox/plugin-container+0x49ba3c)

0x7f9b380986a7 is located 679 bytes to the right of 175104-byte region [0x7f9b3806d800,0x7f9b38098400) allocated by thread T0 (Web Content) here: #0 0x484588 in __interceptor_posix_memalign /builds/slave/moz-toolchain/src/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:132 #1 0x7f9b5a5f1855 in TryAllocAlignedBytes(unsigned long) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/gfx/thebes/gfxImageSurface.cpp:92 #2 0x7f9b5a5f1425 in gfxImageSurface::AllocateAndInit(long, int, bool) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/gfx/thebes/gfxImageSurface.cpp:129 #3 0x7f9b5a57b0ff in gfxPlatformGtk::CreateOffscreenSurface(mozilla::gfx::IntSizeTypedmozilla::gfx::UnknownUnits const&, gfxContentType) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/gfx/thebes/gfxPlatformGtk.cpp:140 #4 0x7f9b5a5738d0 in gfxPlatform::CreateDrawTargetForBackend(mozilla::gfx::BackendType, mozilla::gfx::IntSizeTypedmozilla::gfx::UnknownUnits const&, mozilla::gfx::SurfaceFormat) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/gfx/thebes/gfxPlatform.cpp:1217 #5 0x7f9b5a573b45 in gfxPlatform::CreateOffscreenCanvasDrawTarget(mozilla::gfx::IntSizeTypedmozilla::gfx::UnknownUnits const&, mozilla::gfx::SurfaceFormat) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/gfx/thebes/gfxPlatform.cpp:1233 #6 0x7f9b5a367008 in mozilla::layers::LayerManager::CreateDrawTarget(mozilla::gfx::IntSizeTypedmozilla::gfx::UnknownUnits const&, mozilla::gfx::SurfaceFormat) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/gfx/layers/Layers.cpp:158 #7 0x7f9b5be408a6 in mozilla::dom::CanvasRenderingContext2D::EnsureTarget(mozilla::dom::CanvasRenderingContext2D::RenderingMode) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/dom/canvas/CanvasRenderingContext2D.cpp:1376 #8 0x7f9b5be43d40 in mozilla::dom::CanvasRenderingContext2D::Save() /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/dom/canvas/CanvasRenderingContext2D.cpp:1648 #9 0x7f9b5b4d4b90 in mozilla::dom::CanvasRenderingContext2DBinding::save(JSContext*, JS::Handle<JSObject*>, mozilla::dom::CanvasRenderingContext2D*, JSJitMethodCallArgs const&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/obj-firefox/dom/bindings/./CanvasRenderingContext2DBinding.cpp:1810 #10 0x7f9b5bdbeb56 in mozilla::dom::GenericBindingMethod(JSContext*, unsigned int, JS::Value*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/dom/bindings/BindingUtils.cpp:2609 #11 0x7f9b5f7f8ff2 in js::CallJSNative(JSContext*, bool ()(JSContext, unsigned int, JS::Value*), JS::CallArgs const&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/js/src/jscntxtinlines.h:235 #12 0x7f9b5f7bbe82 in js::Invoke(JSContext*, JS::CallArgs, js::MaybeConstruct) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/js/src/vm/Interpreter.cpp:720:16 #13 0x7f9b5f7eac5e in Interpret(JSContext*, js::RunState&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/js/src/vm/Interpreter.cpp:2961 #14 0x7f9b5f7d7fcb in js::RunScript(JSContext*, js::RunState&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/js/src/vm/Interpreter.cpp:677 #15 0x7f9b5f7bbfe5 in js::Invoke(JSContext*, JS::CallArgs, js::MaybeConstruct) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/js/src/vm/Interpreter.cpp:747 #16 0x7f9b5f785ae4 in js::Invoke(JSContext*, JS::Value const&, JS::Value const&, unsigned int, JS::Value const*, JS::MutableHandleJS::Value) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/js/src/vm/Interpreter.cpp:784 #17 0x7f9b600720a2 in JS_CallFunctionValue(JSContext*, JS::Handle<JSObject*>, JS::HandleJS::Value, JS::HandleValueArray const&, JS::MutableHandleJS::Value) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/js/src/jsapi.cpp:4392 #18 0x7f9b5a788456 in nsFrameMessageManager::ReceiveMessage(nsISupports*, nsIFrameLoader*, bool, nsAString_internal const&, bool, mozilla::dom::StructuredCloneData const*, mozilla::jsipc::CpowHolder*, nsIPrincipal*, nsTArraymozilla::OwningSerializedStructuredCloneBuffer) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/dom/base/nsFrameMessageManager.cpp:1253 #19 0x7f9b5a7873cc in nsFrameMessageManager::ReceiveMessage(nsISupports, nsIFrameLoader*, nsAString_internal const&, bool, mozilla::dom::StructuredCloneData const*, mozilla::jsipc::CpowHolder*, nsIPrincipal*, nsTArraymozilla::OwningSerializedStructuredCloneBuffer) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/dom/base/nsFrameMessageManager.cpp:1070 #20 0x7f9b5caa5ead in mozilla::dom::TabChild::RecvAsyncMessage(nsString const&, mozilla::dom::ClonedMessageData const&, nsTArraymozilla::jsipc::CpowEntry&&, IPC::Principal const&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/dom/ipc/TabChild.cpp:2738 #21 0x7f9b5caa5f4f in non-virtual thunk to mozilla::dom::TabChild::RecvAsyncMessage(nsString const&, mozilla::dom::ClonedMessageData const&, nsTArraymozilla::jsipc::CpowEntry&&, IPC::Principal const&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/obj-firefox/dom/ipc/Unified_cpp_dom_ipc0.cpp:2742 #22 0x7f9b599d6971 in mozilla::dom::PBrowserChild::OnMessageReceived(IPC::Message const&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/obj-firefox/ipc/ipdl/./PBrowserChild.cpp:2547 #23 0x7f9b59ad4f7a in mozilla::dom::PContentChild::OnMessageReceived(IPC::Message const&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/obj-firefox/ipc/ipdl/./PContentChild.cpp:5316 #24 0x7f9b595965a0 in mozilla::ipc::MessageChannel::DispatchAsyncMessage(IPC::Message const&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/glue/MessageChannel.cpp:1279 #25 0x7f9b59594e63 in mozilla::ipc::MessageChannel::DispatchMessage(IPC::Message const&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/glue/MessageChannel.cpp:1198 #26 0x7f9b5958c63c in mozilla::ipc::MessageChannel::OnMaybeDequeueOne() /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/glue/MessageChannel.cpp:1182 #27 0x7f9b59513661 in MessageLoop::RunTask(Task) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/chromium/src/base/message_loop.cc:361 #28 0x7f9b595140df in MessageLoop::DeferOrRunPendingTask(MessageLoop::PendingTask const&) /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/chromium/src/base/message_loop.cc:369 #29 0x7f9b595146ba in MessageLoop::DoWork() /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/ipc/chromium/src/base/message_loop.cc:456

SUMMARY: AddressSanitizer: heap-buffer-overflow /builds/slave/m-cen-l64-asan-d-0000000000000/build/src/gfx/2d/DataSurfaceHelpers.cpp:81 mozilla::gfx::CopySurfaceDataToPackedArray(unsigned char*, unsigned char*, mozilla::gfx::IntSizeTypedmozilla::gfx::UnknownUnits, int, int) Shadow bytes around the buggy address: 0x0ff3e700b080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0ff3e700b090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0ff3e700b0a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0ff3e700b0b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0ff3e700b0c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa =>0x0ff3e700b0d0: fa fa fa fa[fa]fa fa fa fa fa fa fa fa fa fa fa 0x0ff3e700b0e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0ff3e700b0f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0ff3e700b100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0ff3e700b110: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0ff3e700b120: 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 Contiguous container OOB:fc ASan internal: fe ==25926==ABORTING

The original report as published on Mozilla's Bugzilla, by Francisco A.. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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 medium-severity memory corruption bug in Graphics: Canvas2D. Mozilla made it public on 13 July 2015 as CVE-2015-4512.

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.

More by Francisco A

View all

8 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.