Skip to content
Memory corruption Disclosed report

[openh264] ASAN heap-buffer-overflow in WelsDec::McChroma_c

Nils Follow

Originally disclosed on Mozilla

  • Fixed in 44 days
  • Paid in 48 days
  • Disclosed after 44 days

Created attachment 8540717 repro.264

The attached testcase crashes the ASAN build of h264dec of the upcoming openh264 firefox branch (https://github.com/cisco/openh264/tree/v1.3-Firefox36).

The ASAN build has been compiled with USE_ASM=No. It crashes the ASM optimised build unreliably.

The testcases crashes both the 32-bit and 64-bit build.

ASAN output:

==28675==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f9927835820 at pc 0x00000056aa76 bp 0x7fff16ed82d0 sp 0x7fff16ed82c8 WRITE of size 4 at 0x7f9927835820 thread T0 #0 0x56aa75 in WelsDec::McChroma_c(unsigned char const*, int, unsigned char*, int, short, short, int, int) (/home/nils/264/h264dec-ff-1.3-64+0x56aa75) #1 0x570801 in WelsDec::GetInterPred(unsigned char*, unsigned char*, unsigned char*, WelsDec::TagWelsDecoderContext*) (/home/nils/264/h264dec-ff-1.3-64+0x570801) #2 0x5a3776 in WelsDec::WelsTargetMbConstruction(WelsDec::TagWelsDecoderContext*) (/home/nils/264/h264dec-ff-1.3-64+0x5a3776) #3 0x5a283b in WelsDec::WelsTargetSliceConstruction(WelsDec::TagWelsDecoderContext*) (/home/nils/264/h264dec-ff-1.3-64+0x5a283b) #4 0x5202ce in WelsDec::DecodeCurrentAccessUnit(WelsDec::TagWelsDecoderContext*, unsigned char**, TagBufferInfo*) (/home/nils/264/h264dec-ff-1.3-64+0x5202ce) #5 0x51a86a in WelsDec::ConstructAccessUnit(WelsDec::TagWelsDecoderContext*, unsigned char**, TagBufferInfo*) (/home/nils/264/h264dec-ff-1.3-64+0x51a86a) #6 0x4fb580 in WelsDecodeBs (/home/nils/264/h264dec-ff-1.3-64+0x4fb580) #7 0x4ef44b in WelsDec::CWelsDecoder::DecodeFrame2(unsigned char const*, int, unsigned char**, TagBufferInfo*) (/home/nils/264/h264dec-ff-1.3-64+0x4ef44b) #8 0x4e7bf6 in H264DecodeInstance(ISVCDecoder*, char const*, char const*, int&, int&, char const*) (/home/nils/264/h264dec-ff-1.3-64+0x4e7bf6) #9 0x4ead40 in main (/home/nils/264/h264dec-ff-1.3-64+0x4ead40) #10 0x7f9929c4dec4 (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4) #11 0x43e596 in _start (/home/nils/264/h264dec-ff-1.3-64+0x43e596)

0x7f9927835820 is located 5 bytes to the right of 184347-byte region [0x7f9927808800,0x7f992783581b) allocated by thread T0 here: #0 0x4c58b2 in malloc /home/nils/build/llvm/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:40:3 #1 0x56ad61 in WelsMalloc (/home/nils/264/h264dec-ff-1.3-64+0x56ad61)

SUMMARY: AddressSanitizer: heap-buffer-overflow ??:0 WelsDec::McChroma_c(unsigned char const*, int, unsigned char*, int, short, short, int, int) Shadow bytes around the buggy address: 0x0ff3a4efeab0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0ff3a4efeac0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0ff3a4efead0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0ff3a4efeae0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0ff3a4efeaf0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x0ff3a4efeb00: 00 00 00 03[fa]fa fa fa fa fa fa fa fa fa fa fa 0x0ff3a4efeb10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0ff3a4efeb20: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0ff3a4efeb30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0ff3a4efeb40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x0ff3a4efeb50: 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 Container overflow: fc Array cookie: ac Intra object redzone: bb ASan internal: fe Left alloca redzone: ca Right alloca redzone: cb ==28675==ABORTING

The original report as published on Mozilla's Bugzilla, by Nils. 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 high-severity memory corruption bug in Audio/Video: GMP. Mozilla made it public on 5 February 2015.

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 Nils

View all

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