Heap-use-after-free in nsFrameList::FirstChild
Originally disclosed on Mozilla
- Fixed in 13 days
- Paid in 15 months
- Disclosed after 13 days
Created attachment 617267
Testcase
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.162 Safari/535.19
Steps to reproduce:
Tested on Aurora 20120421074909
http://hg.mozilla.org/releases/mozilla-aurora/rev/6f27de794daa
and Trunk 20120419154942
http://hg.mozilla.org/mozilla-central/rev/c861d58b7ade
ASAN stack::
==18828== ERROR: AddressSanitizer heap-use-after-free on address 0x7fdb84d6bd80 at pc 0x7fdbafbd1f54 bp 0x7fffecab7970 sp 0x7fffecab7968
READ of size 8 at 0x7fdb84d6bd80 thread T0
#0 0x7fdbafbd1f54 in nsFrameList::FirstChild() const /usr/local/google/home/aarya/firefox/aurora-src/modules/zlib/src/inffast.c:0
#1 0x7fdb8ac27660 in
0x7fdb84d6bd80 is located 0 bytes inside of 16-byte region [0x7fdb84d6bd80,0x7fdb84d6bd90)
freed by thread T0 here:
#0 0x410dd2 in free ??:0
#1 0x7fdbafd55b96 in operator delete(void*) /usr/local/google/home/aarya/firefox/aurora-src/../../dist/include/mozilla/mozalloc.h:253
#2 0x2000007fdbaf8308
previously allocated by thread T0 here:
#0 0x410e92 in malloc ??:0
#1 0x7fdbb5469450 in moz_xmalloc /usr/local/google/home/aarya/firefox/aurora-src/memory/mozalloc/mozalloc.cpp:103
==18828== ABORTING
Stats: 162M malloced (161M for red zones) by 345347 calls
Stats: 43M realloced by 19180 calls
Stats: 131M freed by 228972 calls
Stats: 0M really freed by 0 calls
Stats: 356M (91189 full pages) mmaped in 89 calls
mmaps by size class: 8:262128; 9:57337; 10:20475; 11:16376; 12:3072; 13:2048; 14:1536; 15:384; 16:704; 17:224; 18:128; 19:56; 20:16;
mallocs by size class: 8:254495; 9:49981; 10:18431; 11:15427; 12:2334; 13:1818; 14:1464; 15:381; 16:639; 17:199; 18:116; 19:49; 20:13;
frees by size class: 8:154593; 9:40949; 10:15619; 11:12669; 12:1671; 13:991; 14:1276; 15:335; 16:566; 17:185; 18:63; 19:45; 20:10;
rfrees by size class:
Stats: malloc large: 377 small slow: 1901
Shadow byte and word:
0x1ffb709ad7b0: fd
0x1ffb709ad7b0: fd fd fd fd fd fd fd fd
More shadow bytes:
0x1ffb709ad790: fd fd fd fd fd fd fd fd
0x1ffb709ad798: fd fd fd fd fd fd fd fd
0x1ffb709ad7a0: fa fa fa fa fa fa fa fa
0x1ffb709ad7a8: fa fa fa fa fa fa fa fa
=>0x1ffb709ad7b0: fd fd fd fd fd fd fd fd
0x1ffb709ad7b8: fd fd fd fd fd fd fd fd
0x1ffb709ad7c0: fa fa fa fa fa fa fa fa
0x1ffb709ad7c8: fa fa fa fa fa fa fa fa
0x1ffb709ad7d0: fd fd fd fd fd fd fd fd
Valgrind stack::
==19089== Invalid read of size 8
==19089== at 0x85360B8: nsFrameList::FirstChild() const (nsFrameList.h:246)
==19089== by 0x862C43C: nsOverflowContinuationTracker::Finish(nsIFrame*) (nsContainerFrame.cpp:1724)
==19089== by 0x861FCF9: nsBlockReflowContext::ReflowBlock(nsRect const&, bool, nsCollapsingMargin&, int, bool, nsLineBox*, nsHTMLReflowState&, unsigned int&, nsBlockReflowState&) (nsBlockReflowContext.cpp:333)
==19089== by 0x8615899: nsBlockFrame::ReflowBlockFrame(nsBlockReflowState&, nsLineList_iterator, bool*) (nsBlockFrame.cpp:3202)
==19089== by 0x8614071: nsBlockFrame::ReflowLine(nsBlockReflowState&, nsLineList_iterator, bool*) (nsBlockFrame.cpp:2511)
==19089== by 0x8612C93: nsBlockFrame::ReflowDirtyLines(nsBlockReflowState&) (nsBlockFrame.cpp:2022)
==19089== by 0x8610E7B: nsBlockFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) (nsBlockFrame.cpp:1071)
==19089== by 0x862A824: nsContainerFrame::ReflowChild(nsIFrame*, nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, int, int, unsigned int, unsigned int&, nsOverflowContinuationTracker*) (nsContainerFrame.cpp:941)
==19089== by 0x862774C: nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&, nsColumnSetFrame::ReflowConfig const&, bool, nsCollapsingMargin*, nsColumnSetFrame::ColumnBalanceData&) (nsColumnSetFrame.cpp:704)
==19089== by 0x8628575: nsColumnSetFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) (nsColumnSetFrame.cpp:1066)
==19089== by 0x861FC1B: nsBlockReflowContext::ReflowBlock(nsRect const&, bool, nsCollapsingMargin&, int, bool, nsLineBox*, nsHTMLReflowState&, unsigned int&, nsBlockReflowState&) (nsBlockReflowContext.cpp:295)
==19089== by 0x8615899: nsBlockFrame::ReflowBlockFrame(nsBlockReflowState&, nsLineList_iterator, bool*) (nsBlockFrame.cpp:3202)
==19089== Address 0x1de137f0 is 0 bytes inside a block of size 16 free'd
==19089== at 0x4C2779F: free (vg_replace_malloc.c:427)
==19089== by 0x69DF1A3: moz_free (mozalloc.cpp:81)
==19089== by 0x862BA11: nsContainerFrame::RemovePropTableFrame(nsPresContext*, nsIFrame*, mozilla::FramePropertyDescriptor const*) (mozalloc.h:253)
==19089== by 0x862B377: nsContainerFrame::StealFrame(nsPresContext*, nsIFrame*, bool) (nsContainerFrame.cpp:1226)
==19089== by 0x861B7DA: nsBlockFrame::StealFrame(nsPresContext*, nsIFrame*, bool) (nsBlockFrame.cpp:5654)
==19089== by 0x862B827: nsContainerFrame::DeleteNextInFlowChild(nsPresContext*, nsIFrame*, bool) (nsContainerFrame.cpp:1372)
==19089== by 0x861BC1B: nsBlockFrame::DeleteNextInFlowChild(nsPresContext*, nsIFrame*, bool) (nsBlockFrame.cpp:5742)
==19089== by 0x861FD2B: nsBlockReflowContext::ReflowBlock(nsRect const&, bool, nsCollapsingMargin&, int, bool, nsLineBox*, nsHTMLReflowState&, unsigned int&, nsBlockReflowState&) (nsBlockReflowContext.cpp:335)
==19089== by 0x8615899: nsBlockFrame::ReflowBlockFrame(nsBlockReflowState&, nsLineList_iterator, bool*) (nsBlockFrame.cpp:3202)
==19089== by 0x8614071: nsBlockFrame::ReflowLine(nsBlockReflowState&, nsLineList_iterator, bool*) (nsBlockFrame.cpp:2511)
==19089== by 0x8612C93: nsBlockFrame::ReflowDirtyLines(nsBlockReflowState&) (nsBlockFrame.cpp:2022)
==19089== by 0x8610E7B: nsBlockFrame::Reflow(nsPresContext*, nsHTMLReflowMetrics&, nsHTMLReflowState const&, unsigned int&) (nsBlockFrame.cpp:1071)
==19089==
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 Layout. Mozilla made it public on 4 May 2012 as CVE-2012-1940.
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.