Skip to content
Memory corruption Disclosed report

heap-buffer-overflow (write) at mozilla::image::nsPNGDecoder::row_callback

Aki Helin Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 6 days
  • Paid in 12 days
  • Disclosed after 6 days

Created attachment 771193 repro

A buffer overflow (write) occurs when the attached picture is opened in aurora channel asan build from a few days ago.

$ opt/firefox-aurora-asan/firefox ff-bofw-rowcallback.png 2>&1 | symbolize | c++filt

==13655== ERROR: AddressSanitizer heap-buffer-overflow on address 0x7f60479d1b80 at pc 0x7f606009aeb4 bp 0x7fffd0325910 sp 0x7fffd0325908 WRITE of size 4 at 0x7f60479d1b80 thread T0 #0 0x7f606009aeb3 in mozilla::image::nsPNGDecoder::row_callback(png_struct_def*, unsigned char*, unsigned int, int) /home/aki/src/mozilla-aurora/image/decoders/nsPNGDecoder.cpp:759 #1 0x7f6063c1b52a in MOZ_PNG_push_have_row /home/aki/src/mozilla-aurora/media/libpng/pngpread.c:1460 #2 0x7f6063c1aab9 in MOZ_PNG_proc_IDAT_data /home/aki/src/mozilla-aurora/media/libpng/pngpread.c:1131 0x7f60479d1b80 is located 0 bytes to the right of 224000-byte region [0x7f604799b080,0x7f60479d1b80) allocated by thread T0 here: #0 0x43deca in posix_memalign ??:0 #1 0x7f6063558fb9 in TryAllocAlignedBytes(unsigned long) /home/aki/src/mozilla-aurora/gfx/thebes/gfxImageSurface.cpp:89 #2 0x7f606003b0a2 in imgFrame::Init(int, int, int, int, gfxASurface::gfxImageFormat, unsigned char) /home/aki/src/mozilla-aurora/image/src/imgFrame.cpp:198 #3 0x7f606002114e in mozilla::image::RasterImage::InternalAddFrame(unsigned int, int, int, int, int, gfxASurface::gfxImageFormat, unsigned char, unsigned char**, unsigned int*, unsigned int**, unsigned int*, imgFrame**) /home/aki/src/mozilla-aurora/image/src/RasterImage.cpp:1283 #4 0x7f6060021cd0 in mozilla::image::RasterImage::EnsureFrame(unsigned int, int, int, int, int, gfxASurface::gfxImageFormat, unsigned char, unsigned char**, unsigned int*, unsigned int**, unsigned int*, imgFrame**) /home/aki/src/mozilla-aurora/image/src/RasterImage.cpp:1412 #5 0x7f6060021ee2 in mozilla::image::RasterImage::EnsureFrame(unsigned int, int, int, int, int, gfxASurface::gfxImageFormat, unsigned char**, unsigned int*, imgFrame**) /home/aki/src/mozilla-aurora/image/src/RasterImage.cpp:1467 #6 0x7f606001bf2f in mozilla::image::RasterImage::InitDecoder(bool, bool) /home/aki/src/mozilla-aurora/image/src/RasterImage.cpp:2161 Shadow byte and word: 0x1fec08f3a370: fa 0x1fec08f3a370: fa fa fa fa fa fa fa fa More shadow bytes: 0x1fec08f3a350: 00 00 00 00 00 00 00 00 0x1fec08f3a358: 00 00 00 00 00 00 00 00 0x1fec08f3a360: 00 00 00 00 00 00 00 00 0x1fec08f3a368: 00 00 00 00 00 00 00 00 =>0x1fec08f3a370: fa fa fa fa fa fa fa fa 0x1fec08f3a378: fa fa fa fa fa fa fa fa 0x1fec08f3a380: fa fa fa fa fa fa fa fa 0x1fec08f3a388: fa fa fa fa fa fa fa fa 0x1fec08f3a390: fa fa fa fa fa fa fa fa Stats: 252M malloced (255M for red zones) by 333799 calls Stats: 49M realloced by 17163 calls Stats: 220M freed by 198590 calls Stats: 83M really freed by 140106 calls Stats: 440M (112722 full pages) mmaped in 110 calls mmaps by size class: 8:212979; 9:32764; 10:12285; 11:16376; 12:2048; 13:1536; 14:1280; 15:384; 16:768; 17:1376; 18:48; 19:40; 20:20; 21:2; mallocs by size class: 8:248243; 9:43800; 10:11322; 11:21445; 12:2360; 13:1984; 14:1609; 15:461; 16:974; 17:1464; 18:72; 19:42; 20:21; 21:2; frees by size class: 8:132541; 9:31130; 10:8119; 11:19784; 12:1559; 13:1323; 14:1412; 15:333; 16:826; 17:1443; 18:61; 19:38; 20:20; 21:1; rfrees by size class: 8:101684; 9:16682; 10:5679; 11:13055; 12:765; 13:636; 14:455; 15:200; 16:613; 17:304; 18:28; 19:3; 20:1; 21:1; Stats: malloc large: 1601 small slow: 2140 ==13655== ABORTING

The original report as published on Mozilla's Bugzilla, by Aki Helin. 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 July 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 Aki Helin

View all

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