Skip to content
Memory corruption Disclosed report

Heap-use-after-free in nsThread::PutEvent

Abhishek Arya Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 37 days
  • Paid in 45 days
  • Disclosed after 37 days
Text
Created attachment 692322
Testcase

Sorry, not a reliable testcase, but this stack is hitting a lot now. This unminimized testcase however is reliably hitting an assert in debug build which seems related.

void MediaDecoderStateMachine::AdvanceFrame()
{
  ..............
  NS_ASSERTION(clock_time >= mStartTime, "Should have positive clock time.");

==21956== ERROR: AddressSanitizer: heap-use-after-free on address 0x7f3ba6f38c38 at pc 0x7f3bbde57ed3 bp 0x7f3bac3f8700 sp 0x7f3bac3f86f8
READ of size 8 at 0x7f3ba6f38c38 thread T8
    #0 0x7f3bbde57ed2 in nsThread::PutEvent(nsIRunnable*) ../../dist/include/mozilla/Mutex.h:74
0x7f3ba6f38c38 is located 24 bytes inside of 152-byte region [0x7f3ba6f38c20,0x7f3ba6f38cb8)
freed by thread T0 here:
    #0 0x426100 in __interceptor_free
    #1 0x7f3bbde56139 in nsThread::Release() ../../dist/include/mozilla/mozalloc.h:224
previously allocated by thread T0 here:
    #0 0x4261c0 in malloc
Thread T8 created by T0 here:
    #0 0x4223c4 in __interceptor_pthread_create
    #1 0x7f3bc3a7277f in _PR_CreateThread nsprpub/pr/src/pthreads/ptthread.c:393
    #2 0x7f3bc3a721e7 in PR_CreateThread nsprpub/pr/src/pthreads/ptthread.c:476
Shadow byte and word:
  0x1fe774de7187: fd
  0x1fe774de7180: fa fa fa fa fd fd fd fd
More shadow bytes:
  0x1fe774de7160: fa fa fa fa fd fd fd fd
  0x1fe774de7168: fd fd fd fd fd fd fd fd
  0x1fe774de7170: fd fd fd fd fd fd fd fd
  0x1fe774de7178: fd fd fd fd fd fd fd fd
=>0x1fe774de7180: fa fa fa fa fd fd fd fd
  0x1fe774de7188: fd fd fd fd fd fd fd fd
  0x1fe774de7190: fd fd fd fd fd fd fd fd
  0x1fe774de7198: fa fa fa fa fa fa fa fa
  0x1fe774de71a0: fa fa fa fa fd fd fd fd
Stats: 379M malloced (340M for red zones) by 565542 calls
Stats: 39M realloced by 27183 calls
Stats: 349M freed by 410529 calls
Stats: 315M really freed by 361763 calls
Stats: 285M (73138 full pages) mmaped in 547 calls
  mmaps   by size class: 6:98292; 7:94185; 8:36846; 9:16368; 10:9198; 11:6630; 12:2432; 13:2688; 14:2464; 15:224; 16:784; 17:460; 18:30; 19:33; 20:21;
  mallocs by size class: 6:208039; 7:186369; 8:84944; 9:30757; 10:14175; 11:16347; 12:4134; 13:8752; 14:7741; 15:512; 16:2108; 17:1552; 18:48; 19:40; 20:24;
  frees   by size class: 6:155481; 7:121055; 8:62848; 9:23201; 10:10552; 11:14243; 12:3103; 13:8525; 14:7497; 15:392; 16:2004; 17:1528; 18:39; 19:39; 20:22;
  rfrees  by size class: 6:140406; 7:102931; 8:55273; 9:21797; 10:9463; 11:13167; 12:2818; 13:6496; 14:5584; 15:377; 16:1830; 17:1521; 18:39; 19:39; 20:22;
Stats: malloc large: 4284 small slow: 11087
==21956== ABORTING

The original report as published on Mozilla's Bugzilla, by Abhishek Arya. 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 Audio/Video. Mozilla made it public on 20 January 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 Abhishek Arya

View all

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