Heap-use-after-free in mozSpellChecker::SetCurrentDictionary
Originally disclosed on Mozilla
- Fixed in 9 days
- Paid in 12 months
- Disclosed after 9 days
Reproduced on trunk. It wasn't a reliable crash, will update bug if i get a reliable testcase. Looks like |this|(mozSpellChecker) is blown from underneath[see free stack] and then causes a crash on reading its member variable here
357 mSpellCheckingEngine->SetPersonalDictionary(personalDictionary.get());
20120707214206
http://hg.mozilla.org/mozilla-central/rev/9533b40ff28b
=================================================================
==7193== ERROR: AddressSanitizer heap-use-after-free on address 0x7fd80c73caa8 at pc 0x7fd83187223d bp 0x7fff83f39930 sp 0x7fff83f39928
READ of size 8 at 0x7fd80c73caa8 thread T0
#0 0x7fd83187223d in mozSpellChecker::SetCurrentDictionary(nsAString_internal const&) extensions/spellcheck/src/mozSpellChecker.cpp:357
#1 0x7fd83133d55d in nsEditorSpellCheck::SetCurrentDictionary(nsAString_internal const&) editor/composer/src/nsEditorSpellCheck.cpp:523
#2 0x7fd83133ede7 in nsEditorSpellCheck::UpdateCurrentDictionary() editor/composer/src/nsEditorSpellCheck.cpp:651
#3 0x7fd83188b2d6 in mozInlineSpellChecker::UpdateCurrentDictionary() extensions/spellcheck/src/mozInlineSpellChecker.cpp:1783
#4 0x7fd830558864 in nsEditorEventListener::Focus(nsIDOMEvent*) editor/libeditor/base/nsEditorEventListener.cpp:888
#5 0x7fd83055392f in nsEditorEventListener::HandleEvent(nsIDOMEvent*) editor/libeditor/base/nsEditorEventListener.cpp:311
#6 0x7fd82fd3939e in nsRefPtr<nsIDOMEventListener>::operator nsIDOMEventListener*() const content/events/src/nsEventListenerManager.cpp:818
#7 0x7fd82fd9979d in nsEventTargetChainItem::HandleEvent(nsEventChainPostVisitor&, unsigned int, bool, nsCxPusher*) content/events/src/nsEventListenerManager.h:143
0x7fd80c73caa8 is located 40 bytes inside of 56-byte region [0x7fd80c73ca80,0x7fd80c73cab8)
freed by thread T0 here:
#0 0x424442 in free
#1 0x7fd83186bc99 in mozSpellChecker::Release() extensions/spellcheck/src/mozSpellChecker.cpp:16
#2 0x7fd83052a870 in nsCOMPtr<nsIInlineSpellChecker>::~nsCOMPtr() ../../../dist/include/nsCOMPtr.h:442
#3 0x7fd83052a68d in non-virtual thunk to nsEditor::Observe(nsISupports*, char const*, unsigned short const*) ../../../dist/include/nsCOMPtr.h:757
#4 0x7fd831ca14e5 in nsTHashtable<nsObserverList>::GetEntry(char const*) const ../../dist/include/nsTHashtable.h:147
previously allocated by thread T0 here:
#0 0x424502 in __interceptor_malloc
#1 0x7fd8349d61a9 in moz_xmalloc memory/mozalloc/mozalloc.cpp:54
==7193== ABORTING
Stats: 186M malloced (225M for red zones) by 546881 calls
Stats: 36M realloced by 21270 calls
Stats: 147M freed by 250321 calls
Stats: 13M really freed by 49274 calls
Stats: 420M (107580 full pages) mmaped in 105 calls
mmaps by size class: 8:425958; 9:57337; 10:20475; 11:14329; 12:5120; 13:3072; 14:1792; 15:512; 16:704; 17:128; 18:224; 19:40; 20:16;
mallocs by size class: 8:448516; 9:54348; 10:19102; 11:14230; 12:4418; 13:2919; 14:1824; 15:407; 16:723; 17:119; 18:221; 19:41; 20:13;
frees by size class: 8:177903; 9:37821; 10:14745; 11:11000; 12:3384; 13:2594; 14:1557; 15:344; 16:652; 17:98; 18:173; 19:39; 20:11;
rfrees by size class: 8:42301; 9:3888; 10:1120; 11:1186; 12:273; 13:185; 14:128; 15:52; 16:129; 17:7; 18:4; 19:1;
Stats: malloc large: 394 small slow: 2548
Shadow byte and word:
0x1ffb018e7955: fd
0x1ffb018e7950: fd fd fd fd fd fd fd fd
More shadow bytes:
0x1ffb018e7930: fd fd fd fd fd fd fd fd
0x1ffb018e7938: fd fd fd fd fd fd fd fd
0x1ffb018e7940: fa fa fa fa fa fa fa fa
0x1ffb018e7948: fa fa fa fa fa fa fa fa
=>0x1ffb018e7950: fd fd fd fd fd fd fd fd
0x1ffb018e7958: fd fd fd fd fd fd fd fd
0x1ffb018e7960: fa fa fa fa fa fa fa fa
0x1ffb018e7968: fa fa fa fa fa fa fa fa
0x1ffb018e7970: 00 00 00 00 00 00 00 00
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 Spelling checker. Mozilla made it public on 18 July 2012 as CVE-2012-3960.
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.