Skip to content
Memory corruption Disclosed report CVE-2014-1576

Heap-buffer-overflow in nsTransformedTextRun::SetCapitalization

Atte Kettunen Follow

Originally disclosed on Mozilla

  • Fixed in 58 days
  • Paid in 35 days
  • Disclosed after 58 days

Created attachment 8459558 Repro-file

Tested on:

OS: Ubuntu 12.04

Firefox: ASAN debug prebuild from https://ftp.mozilla.org/pub/mozilla.org/firefox/tinderbox-builds/mozilla-central-linux64-asan-debug/1405918761/

Sometimes the repro-file fails to trigger the crash. If the crash doesn't occur after couple of refresh, restart the browser. Also the crash reproduces a lot more reliably with debug-build than with opt-build.

ASAN trace:

[7111] ###!!! ASSERTION: Text run should be transformed!: 'mTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_TRANSFORMED', file /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsTextFrame.cpp, line 970

==7111==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60c0002d1a40 at pc 0x7fdb4338f050 bp 0x7fffaeeeb670 sp 0x7fffaeeeb668 READ of size 8 at 0x60c0002d1a40 thread T0 #0 0x7fdb4338f04f in nsTArray_base<nsTArrayInfallibleAllocator, nsTArray_CopyWithMemutils>::Length() const /builds/slave/m-cen-l64-asan-d-0000000000000/build/xpcom/build/../glue/nsTArray.h:323 #1 0x7fdb433fe598 in nsTArray_base<nsTArrayInfallibleAllocator, nsTArray_CopyWithMemutils>::IsEmpty() const /builds/slave/m-cen-l64-asan-d-0000000000000/build/obj-firefox/xpcom/base/../../dist/include/nsTArray.h:326 #2 0x7fdb47483e48 in nsTransformedTextRun::SetCapitalization(unsigned int, unsigned int, bool*, gfxContext*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsTextRunTransformations.cpp:60 #3 0x7fdb46783ded in nsLineBreaker::AppendText(nsIAtom*, char16_t const*, unsigned int, unsigned int, nsILineBreakSink*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/content/base/src/nsLineBreaker.cpp:291 #4 0x7fdb46784360 in nsLineBreaker::AppendText(nsIAtom*, unsigned char const*, unsigned int, unsigned int, nsILineBreakSink*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/content/base/src/nsLineBreaker.cpp:327 #5 0x7fdb4745ddca in BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun*, void const*, unsigned int) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsTextFrame.cpp:2399 #6 0x7fdb474580b1 in BuildTextRunsScanner::SetupLineBreakerContext(gfxTextRun*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsTextFrame.cpp:2304 #7 0x7fdb474574ea in BuildTextRunsScanner::FlushFrames(bool, bool) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsTextFrame.cpp:1453 #8 0x7fdb47460bee in BuildTextRuns(gfxContext*, nsTextFrame*, nsIFrame*, nsLineList_iterator const*, nsTextFrame::TextRunType) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsTextFrame.cpp:1401 #9 0x7fdb4745f4e8 in nsTextFrame::EnsureTextRun(nsTextFrame::TextRunType, gfxContext*, nsIFrame*, nsLineList_iterator const*, unsigned int*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsTextFrame.cpp:2559 #10 0x7fdb4747a49e in nsTextFrame::AddInlineMinWidthForFlow(nsRenderingContext*, nsIFrame::InlineMinWidthData*, nsTextFrame::TextRunType) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsTextFrame.cpp:7018 #11 0x7fdb4747b87f in nsTextFrame::AddInlineMinWidth(nsRenderingContext*, nsIFrame::InlineMinWidthData*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsTextFrame.cpp:7175 #12 0x7fdb4731cb1d in nsBlockFrame::GetMinWidth(nsRenderingContext*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsBlockFrame.cpp:733 . . . #60 0x7fdb48107135 in nsAppStartup::Run() /builds/slave/m-cen-l64-asan-d-0000000000000/build/toolkit/components/startup/nsAppStartup.cpp:278 #61 0x7fdb47f69b3b in XREMain::XRE_mainRun() /builds/slave/m-cen-l64-asan-d-0000000000000/build/toolkit/xre/nsAppRunner.cpp:4013 #62 0x7fdb47f6af4f in XREMain::XRE_main(int, char**, nsXREAppData const*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/toolkit/xre/nsAppRunner.cpp:4084 #63 0x7fdb47f6b9d2 in XRE_main /builds/slave/m-cen-l64-asan-d-0000000000000/build/toolkit/xre/nsAppRunner.cpp:4298 #64 0x489fed in do_main(int, char**, nsIFile*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/browser/app/nsBrowserApp.cpp:282 #65 0x489571 in main /builds/slave/m-cen-l64-asan-d-0000000000000/build/browser/app/nsBrowserApp.cpp:643 #66 0x7fdb529e276c in ?? ??:0 #67 0x48925c in _start ??:0

0x60c0002d1a40 is located 0 bytes to the right of 128-byte region [0x60c0002d19c0,0x60c0002d1a40) allocated by thread T0 here: #0 0x471871 in __interceptor_malloc asan_rtl #1 0x7fdb449893f8 in gfxTextRun::AllocateStorageForTextRun(unsigned long, unsigned int) /builds/slave/m-cen-l64-asan-d-0000000000000/build/gfx/thebes/gfxFont.cpp:6461 #2 0x7fdb4497fb13 in gfxTextRun::Create(gfxTextRunFactory::Parameters const*, unsigned int, gfxFontGroup*, unsigned int) /builds/slave/m-cen-l64-asan-d-0000000000000/build/gfx/thebes/gfxFont.cpp:6478 #3 0x7fdb44980f38 in gfxFontGroup::MakeTextRun(unsigned char const*, unsigned int, gfxTextRunFactory::Parameters const*, unsigned int) /builds/slave/m-cen-l64-asan-d-0000000000000/build/gfx/thebes/gfxFont.cpp:5196 #4 0x7fdb4745d811 in gfxTextRun* MakeTextRun<unsigned char>(unsigned char const*, unsigned int, gfxFontGroup*, gfxTextRunFactory::Parameters const*, unsigned int) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsTextFrame.cpp:569 #5 0x7fdb47459dc5 in BuildTextRunsScanner::BuildTextRunForFrames(void*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsTextFrame.cpp:2145 #6 0x7fdb47457642 in BuildTextRunsScanner::FlushFrames(bool, bool) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsTextFrame.cpp:1472 #7 0x7fdb47460bee in BuildTextRuns(gfxContext*, nsTextFrame*, nsIFrame*, nsLineList_iterator const*, nsTextFrame::TextRunType) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsTextFrame.cpp:1401 #8 0x7fdb4745f4e8 in nsTextFrame::EnsureTextRun(nsTextFrame::TextRunType, gfxContext*, nsIFrame*, nsLineList_iterator const*, unsigned int*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsTextFrame.cpp:2559 #9 0x7fdb4747a49e in nsTextFrame::AddInlineMinWidthForFlow(nsRenderingContext*, nsIFrame::InlineMinWidthData*, nsTextFrame::TextRunType) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsTextFrame.cpp:7018 #10 0x7fdb4747b87f in nsTextFrame::AddInlineMinWidth(nsRenderingContext*, nsIFrame::InlineMinWidthData*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsTextFrame.cpp:7175 #11 0x7fdb4731cb1d in nsBlockFrame::GetMinWidth(nsRenderingContext*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsBlockFrame.cpp:733 #12 0x7fdb472ab05a in nsLayoutUtils::IntrinsicForContainer(nsRenderingContext*, nsIFrame*, nsLayoutUtils::IntrinsicWidthType, unsigned int) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/base/nsLayoutUtils.cpp:3732 #13 0x7fdb4731c958 in nsBlockFrame::GetMinWidth(nsRenderingContext*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsBlockFrame.cpp:713 #14 0x7fdb472ab05a in nsLayoutUtils::IntrinsicForContainer(nsRenderingContext*, nsIFrame*, nsLayoutUtils::IntrinsicWidthType, unsigned int) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/base/nsLayoutUtils.cpp:3732 #15 0x7fdb4731c958 in nsBlockFrame::GetMinWidth(nsRenderingContext*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsBlockFrame.cpp:713 #16 0x7fdb472ab05a in nsLayoutUtils::IntrinsicForContainer(nsRenderingContext*, nsIFrame*, nsLayoutUtils::IntrinsicWidthType, unsigned int) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/base/nsLayoutUtils.cpp:3732 #17 0x7fdb4731c958 in nsBlockFrame::GetMinWidth(nsRenderingContext*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsBlockFrame.cpp:713 #18 0x7fdb472ab05a in nsLayoutUtils::IntrinsicForContainer(nsRenderingContext*, nsIFrame*, nsLayoutUtils::IntrinsicWidthType, unsigned int) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/base/nsLayoutUtils.cpp:3732 #19 0x7fdb4731c958 in nsBlockFrame::GetMinWidth(nsRenderingContext*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsBlockFrame.cpp:713 #20 0x7fdb472ab05a in nsLayoutUtils::IntrinsicForContainer(nsRenderingContext*, nsIFrame*, nsLayoutUtils::IntrinsicWidthType, unsigned int) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/base/nsLayoutUtils.cpp:3732 #21 0x7fdb4731c958 in nsBlockFrame::GetMinWidth(nsRenderingContext*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsBlockFrame.cpp:713 #22 0x7fdb472ab05a in nsLayoutUtils::IntrinsicForContainer(nsRenderingContext*, nsIFrame*, nsLayoutUtils::IntrinsicWidthType, unsigned int) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/base/nsLayoutUtils.cpp:3732 #23 0x7fdb4731c958 in nsBlockFrame::GetMinWidth(nsRenderingContext*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsBlockFrame.cpp:713 #24 0x7fdb472ab05a in nsLayoutUtils::IntrinsicForContainer(nsRenderingContext*, nsIFrame*, nsLayoutUtils::IntrinsicWidthType, unsigned int) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/base/nsLayoutUtils.cpp:3732 #25 0x7fdb4731c958 in nsBlockFrame::GetMinWidth(nsRenderingContext*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsBlockFrame.cpp:713 #26 0x7fdb4739806e in nsFrame::ShrinkWidthToFit(nsRenderingContext*, int) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsFrame.cpp:4240 #27 0x7fdb47364d14 in nsContainerFrame::ComputeAutoSize(nsRenderingContext*, nsSize, int, nsSize, nsSize, nsSize, bool) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsContainerFrame.cpp:899 #28 0x7fdb47396adc in nsFrame::ComputeSize(nsRenderingContext*, nsSize, int, nsSize, nsSize, nsSize, unsigned int) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsFrame.cpp:4030 #29 0x7fdb473f7c1d in nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext*, nsHTMLReflowState const*, int, int, nsIAtom*) /builds/slave/m-cen-l64-asan-d-0000000000000/build/layout/generic/nsHTMLReflowState.cpp:1458

SUMMARY: AddressSanitizer: heap-buffer-overflow ??:0 ?? Shadow bytes around the buggy address: 0x0c18800522f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c1880052300: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 0x0c1880052310: 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa 0x0c1880052320: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c1880052330: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 =>0x0c1880052340: 00 00 00 00 00 00 00 00[fa]fa fa fa fa fa fa fa 0x0c1880052350: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c1880052360: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 0x0c1880052370: 00 00 00 00 00 00 00 04 fa fa fa fa fa fa fa fa 0x0c1880052380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x0c1880052390: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00 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 Contiguous container OOB:fc ASan internal: fe ==7111==ABORTING

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 high-severity memory corruption bug in CSS Parsing and Computation. Mozilla made it public on 17 September 2014 as CVE-2014-1576.

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.