Skip to content
Memory corruption Disclosed report

Out of bounds stack read in mozilla::dom::Element::ParseAttribute

Atte Kettunen Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 3 days
  • Paid in 17 days
  • Disclosed after 3 days
Text
Created attachment 8597586
repro-file.html

Tested on:

OS: Ubuntu 14.04

Firefox: ASAN build from https://ftp.mozilla.org/pub/mozilla.org/firefox/tinderbox-builds/mozilla-central-linux64-asan/1429905257/

ASAN-trace:

==32503==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff966358a8 at pc 0x7fd82a45d59e bp 0x7fff966353a0 sp 0x7fff96635398
READ of size 4 at 0x7fff966358a8 thread T0 (Web Content)
    #0 0x7fd82a45d59d in IsEmpty /home/attekett/firefox/objdir-ff-asan/dom/base/../../dist/include/nsTSubstring.h:242:5
    #1 0x7fd82a45d59d in mozilla::dom::Element::ParseAttribute(int, nsIAtom*, nsAString_internal const&, nsAttrValue&) /home/attekett/firefox/dom/base/Element.cpp:2373:0
    #2 0x7fd82a834270 in nsStyledElementNotElementCSSInlineStyle::ParseAttribute(int, nsIAtom*, nsAString_internal const&, nsAttrValue&) /home/attekett/firefox/dom/base/nsStyledElement.cpp:43:10
    #3 0x7fd82cb5a590 in nsGenericHTMLElement::ParseAttribute(int, nsIAtom*, nsAString_internal const&, nsAttrValue&) /home/attekett/firefox/dom/html/nsGenericHTMLElement.cpp:1031:10
    #4 0x7fd82c9c6e47 in mozilla::dom::HTMLDivElement::ParseAttribute(int, nsIAtom*, nsAString_internal const&, nsAttrValue&) /home/attekett/firefox/dom/html/HTMLDivElement.cpp:59:10
    #5 0x7fd82a45a6dc in mozilla::dom::Element::SetAttr(int, nsIAtom*, nsIAtom*, nsAString_internal const&, bool) /home/attekett/firefox/dom/base/Element.cpp:2195:8
    #6 0x7fd82cbab69a in nsGenericHTMLElement::SetAttr(int, nsIAtom*, nsIAtom*, nsAString_internal const&, bool) /home/attekett/firefox/dom/html/nsGenericHTMLElement.cpp:905:17
    #7 0x7fd82c9db27f in SetAttr /home/attekett/firefox/objdir-ff-asan/dom/html/../../dist/include/mozilla/dom/Element.h:446:12
    #8 0x7fd82c9db27f in SetId /home/attekett/firefox/objdir-ff-asan/dom/html/../../dist/include/mozilla/dom/Element.h:594:0
    #9 0x7fd82c9db27f in SetId /home/attekett/firefox/dom/html/nsGenericHTMLElement.h:337:0
    #10 0x7fd82c9db27f in non-virtual thunk to nsGenericHTMLElement::SetId(nsAString_internal const&) /home/attekett/firefox/dom/html/nsGenericHTMLElement.h:417:0
    #11 0x7fd82df68ec9 in nsHTMLEditor::RelativeFontChangeOnTextNode(int, nsIDOMCharacterData*, int, int) /home/attekett/firefox/editor/libeditor/nsHTMLEditorStyle.cpp:1542:3
.
.
.
Address 0x7fff966358a8 is located in stack of thread T0 (Web Content) at offset 264 in frame
    #0 0x7fd82df68b9f in nsHTMLEditor::RelativeFontChangeOnTextNode(int, nsIDOMCharacterData*, int, int) /home/attekett/firefox/editor/libeditor/nsHTMLEditorStyle.cpp:1521:0

  This frame has 10 object(s):
    [32, 40) 'node.i13'
    [64, 80) 'rv.i14'
    [96, 104) 'node.i'
    [128, 144) 'rv.i'
    [160, 168) 'textNode'
    [192, 200) 'tmp'
    [224, 232) 'node'
    [256, 260) 'textLen' <== Memory access at offset 264 overflows this variable
    [272, 280) 'sibling' <== Memory access at offset 264 underflows this variable
    [304, 312) ''
HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext
      (longjmp and C++ exceptions *are* supported)

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 critical-severity memory corruption bug in DOM: Editor. Mozilla made it public on 28 April 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 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.