Skip to content
Memory corruption Disclosed report

Heap-use-after-free in imgFrame::MarkImageDataDirty

Atte Kettunen Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 9 days
  • Paid in 10 days
  • Disclosed after 9 days

Created attachment 756929 Repro-file

Tested on:

OS: Ubuntu 12.04

Firefox: ASAN debug-build from https://ftp.mozilla.org/pub/mozilla.org/firefox/tinderbox-builds/mozilla-central-linux64-dbg-asan/1370061653/

ASAN-report:

==17560== ERROR: AddressSanitizer: heap-use-after-free on address 0x7fa676aa7140 at pc 0x7fa6a47a51b7 bp 0x7fff044eafe0 sp 0x7fff044eafd8 READ of size 8 at 0x7fa676aa7140 thread T0 #0 0x7fa6a47a51b6 in nsRefPtr<gfxImageSurface>::get() const /builds/slave/m-cen-l64-dbg-asan-00000000000/build/../../dist/include/nsAutoPtr.h:1009 #1 0x7fa6a47b9539 in imgFrame::MarkImageDataDirty() /builds/slave/m-cen-l64-dbg-asan-00000000000/build/image/src/imgFrame.cpp:680 #2 0x7fa6a4797f84 in mozilla::image::RasterImage::FinishedSomeDecoding(mozilla::image::RasterImage::eShutdownIntent, mozilla::image::RasterImage::DecodeRequest*) /builds/slave/m-cen-l64-dbg-asan-00000000000/build/image/src/RasterImage.cpp:3486 #3 0x7fa6a479d06e in mozilla::image::RasterImage::DecodePool::DecodeABitOf(mozilla::image::RasterImage*) /builds/slave/m-cen-l64-dbg-asan-00000000000/build/image/src/RasterImage.cpp:3681 #4 0x7fa6a479c9ff in mozilla::image::RasterImage::RequestDecodeCore(mozilla::image::RasterImage::RequestDecodeType) /builds/slave/m-cen-l64-dbg-asan-00000000000/build/image/src/RasterImage.cpp:2880 #5 0x7fa6a500b124 in nsImageLoadingContent::OnStopRequest(imgIRequest*, tag_nsresult) /builds/slave/m-cen-l64-dbg-asan-00000000000/build/content/base/src/nsImageLoadingContent.cpp:239 #6 0x7fa6a500a7da in nsImageLoadingContent::Notify(imgIRequest*, int, nsIntRect const*) /builds/slave/m-cen-l64-dbg-asan-00000000000/build/content/base/src/nsImageLoadingContent.cpp:164 #7 0x7fa6a47def02 in imgRequestProxy::OnStopRequest(bool) /builds/slave/m-cen-l64-dbg-asan-00000000000/build/image/src/imgRequestProxy.cpp:848 #8 0x7fa6a47e3c6c in imgStatusTracker::SyncNotifyState(nsTObserverArray<imgRequestProxy*>&, bool, unsigned int, nsIntRect&, bool) /builds/slave/m-cen-l64-dbg-asan-00000000000/build/image/src/imgStatusTracker.cpp:518 #9 0x7fa6a47e47f1 in imgStatusTracker::SyncNotifyDifference(imgStatusTracker::StatusDiff) /builds/slave/m-cen-l64-dbg-asan-00000000000/build/image/src/imgStatusTracker.cpp:581 . . . freed by thread T0 here: #0 0x43afe0 in free ??:0 #1 0x7fa6a47952e1 in operator delete(void*) /builds/slave/m-cen-l64-dbg-asan-00000000000/build/../../dist/include/mozilla/mozalloc.h:225 #2 0x7fa6a4796398 in mozilla::image::RasterImage::EnsureFrame(unsigned int, int, int, int, int, gfxASurface::gfxImageFormat, unsigned char, unsigned char**, unsigned int*, unsigned int**, unsigned int*, imgFrame**) /builds/slave/m-cen-l64-dbg-asan-00000000000/build/image/src/RasterImage.cpp:1440 #3 0x7fa6a47965ba in mozilla::image::RasterImage::EnsureFrame(unsigned int, int, int, int, int, gfxASurface::gfxImageFormat, unsigned char**, unsigned int*, imgFrame**) /builds/slave/m-cen-l64-dbg-asan-00000000000/build/image/src/RasterImage.cpp:1457 #4 0x7fa6a47853ce in mozilla::image::Decoder::AllocateFrame() /builds/slave/m-cen-l64-dbg-asan-00000000000/build/image/src/Decoder.cpp:210 #5 0x7fa6a47841d9 in mozilla::image::Decoder::Write(char const*, unsigned int) /builds/slave/m-cen-l64-dbg-asan-00000000000/build/image/src/Decoder.cpp:111 #6 0x7fa6a4797cc4 in mozilla::image::RasterImage::WriteToDecoder(char const*, unsigned int) /builds/slave/m-cen-l64-dbg-asan-00000000000/build/image/src/RasterImage.cpp:2722 #7 0x7fa6a479d4e6 in mozilla::image::RasterImage::DecodeSomeData(unsigned int) /builds/slave/m-cen-l64-dbg-asan-00000000000/build/image/src/RasterImage.cpp:3337 #8 0x7fa6a47a0b26 in mozilla::image::RasterImage::DecodePool::DecodeSomeOfImage(mozilla::image::RasterImage*, mozilla::image::RasterImage::DecodePool::DecodeType, unsigned int) /builds/slave/m-cen-l64-dbg-asan-00000000000/build/image/src/RasterImage.cpp:3878 . . .

The original report as published on Mozilla's Bugzilla, by Atte Kettunen. 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 critical-severity memory corruption bug in Graphics: ImageLib. Mozilla made it public on 10 June 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.

More by Atte Kettunen

View all

62 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.