Skip to content
Memory corruption Disclosed report CVE-2012-4185

Global-buffer-overflow in nsCharTraits::length

Atte Kettunen Follow

Originally disclosed on Mozilla

Critical View original
  • Fixed in 4 days
  • Paid in 5 months
  • Disclosed after 4 days

Created attachment 655460 Original repro-file.

Tested with build from

http://people.mozilla.org/~choller/firefox/asan/20120826-mozilla-central-linux64-debug-b3cce81fef1a+asan.html

ASAN-report from the original repro-file:

###!!! ASSERTION: Decoder returned an error but filled the output buffer! Should not happen.: '0 < capacity - haveRead', file /builds/slave/try-lnx64-dbg/build/netwerk/base/src/nsUnicharStreamLoader.cpp, line 225

==1146== ERROR: AddressSanitizer global-buffer-overflow on address 0x7f80ca470002 at pc 0x7f80c2dce5ce bp 0x7ffff1b53d20 sp 0x7ffff1b53d18 READ of size 2 at 0x7f80ca470002 thread T0 #0 0x7f80c2dce5ce in nsCharTraits<unsigned short>::length(unsigned short const*) /builds/slave/try-lnx64-dbg/build/../../../dist/include/nsCharTraits.h:345 #1 0x7f80c52900bc in nsAString_internal::Assign(unsigned short const*, unsigned int, mozilla::fallible_t const&) /builds/slave/try-lnx64-dbg/build/xpcom/string/src/nsTSubstring.cpp:304 #2 0x7f80c5290019 in nsAString_internal::Assign(unsigned short const*, unsigned int) /builds/slave/try-lnx64-dbg/build/xpcom/string/src/nsTSubstring.cpp:290 #3 0x7f80c2e723c3 in nsString::operator=(unsigned short const*) /builds/slave/try-lnx64-dbg/build/../../dist/include/nsTString.h:65 #4 0x7f80c46c11a7 in nsDocShell::SetTitle(unsigned short const*) /builds/slave/try-lnx64-dbg/build/docshell/base/nsDocShell.cpp:5236 #5 0x7f80c46c16b0 in non-virtual thunk to nsDocShell::SetTitle(unsigned short const*) /builds/slave/try-lnx64-dbg/build/media/libvpx/vp8/encoder/x86/quantize_mmx.asm:0 #6 0x7f80c35ecf4a in nsDocument::DoNotifyPossibleTitleChange() /builds/slave/try-lnx64-dbg/build/content/base/src/nsDocument.cpp:5288 #7 0x7f80c360a34a in nsRunnableMethodImpl<void (nsDocument::)(), false>::Run() /builds/slave/try-lnx64-dbg/build/../../../dist/include/nsThreadUtils.h:349 #8 0x7f80c5248003 in nsThread::ProcessNextEvent(bool, bool) /builds/slave/try-lnx64-dbg/build/xpcom/threads/nsThread.cpp:624 #9 0x7f80c5199a93 in NS_ProcessNextEvent_P(nsIThread*, bool) /builds/slave/try-lnx64-dbg/build/obj-firefox/xpcom/build/nsThreadUtils.cpp:220 #10 0x7f80c4ecd749 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /builds/slave/try-lnx64-dbg/build/ipc/glue/MessagePump.cpp:82 #11 0x7f80c52cdca2 in MessageLoop::RunInternal() /builds/slave/try-lnx64-dbg/build/ipc/chromium/src/base/message_loop.cc:209 #12 0x7f80c52cdb9f in MessageLoop::Run() /builds/slave/try-lnx64-dbg/build/ipc/chromium/src/base/message_loop.cc:176 #13 0x7f80c4c70c82 in nsBaseAppShell::Run() /builds/slave/try-lnx64-dbg/build/widget/xpwidgets/nsBaseAppShell.cpp:165 #14 0x7f80c482cde1 in nsAppStartup::Run() /builds/slave/try-lnx64-dbg/build/toolkit/components/startup/nsAppStartup.cpp:273 #15 0x7f80c2abca75 in XREMain::XRE_mainRun() /builds/slave/try-lnx64-dbg/build/toolkit/xre/nsAppRunner.cpp:3800 #16 0x7f80c2abdb43 in XREMain::XRE_main(int, char**, nsXREAppData const*) /builds/slave/try-lnx64-dbg/build/toolkit/xre/nsAppRunner.cpp:3877 #17 0x7f80c2abe4e2 in XRE_main /builds/slave/try-lnx64-dbg/build/toolkit/xre/nsAppRunner.cpp:3953 #18 0x408dec in do_main(int, char**) /builds/slave/try-lnx64-dbg/build/browser/app/nsBrowserApp.cpp:174 #19 0x4085db in main /builds/slave/try-lnx64-dbg/build/browser/app/nsBrowserApp.cpp:279 #20 0x7f80cd06d76d in __libc_start_main /build/buildd/eglibc-2.15/csu/libc-start.c:258 0x7f80ca470002 is located 0 bytes to the right of global variable 'gNullChar (/builds/slave/try-lnx64-dbg/build/xpcom/string/src/nsSubstring.cpp)' (0x7f80ca470000) of size 2 ==1146== ABORTING Stats: 235M malloced (239M for red zones) by 324882 calls Stats: 30M realloced by 21484 calls Stats: 202M freed by 199576 calls Stats: 68M really freed by 103398 calls Stats: 436M (111696 full pages) mmaped in 109 calls mmaps by size class: 8:196596; 9:32764; 10:20475; 11:16376; 12:3072; 13:1536; 14:1280; 15:256; 16:448; 17:1248; 18:192; 19:40; 20:16; mallocs by size class: 8:236195; 9:35940; 10:24728; 11:19418; 12:2929; 13:1796; 14:1466; 15:270; 16:632; 17:1255; 18:195; 19:44; 20:14; frees by size class: 8:131552; 9:24822; 10:20131; 11:16183; 12:1854; 13:1549; 14:1301; 15:227; 16:520; 17:1244; 18:140; 19:41; 20:12; rfrees by size class: 8:69590; 9:9871; 10:11815; 11:9747; 12:640; 13:470; 14:487; 15:107; 16:301; 17:358; 18:6; 19:5; 20:1; Stats: malloc large: 1508 small slow: 1931 Shadow byte and word: 0x1ff01948e000: 2 0x1ff01948e000: 02 f9 f9 f9 f9 f9 f9 f9 More shadow bytes: 0x1ff01948dfe0: 00 00 f9 f9 f9 f9 f9 f9 0x1ff01948dfe8: 00 f9 f9 f9 f9 f9 f9 f9 0x1ff01948dff0: 00 00 f9 f9 f9 f9 f9 f9 0x1ff01948dff8: 00 f9 f9 f9 f9 f9 f9 f9 =>0x1ff01948e000: 02 f9 f9 f9 f9 f9 f9 f9 0x1ff01948e008: 00 00 00 f9 f9 f9 f9 f9 0x1ff01948e010: 00 f9 f9 f9 f9 f9 f9 f9 0x1ff01948e018: 00 f9 f9 f9 f9 f9 f9 f9 0x1ff01948e020: 00 f9 f9 f9 f9 f9 f9 f9

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 Networking. Mozilla made it public on 30 August 2012 as CVE-2012-4185.

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.