heap-buffer-overflow in gfxShapedWord::CompressedGlyph::IsClusterStart
Originally disclosed on Mozilla
- Fixed in 11 days
- Paid in 27 days
- Disclosed after 11 days
Created attachment 674555
Testcase
Reproduces on trunk.
=================================================================
==18316== ERROR: AddressSanitizer heap-buffer-overflow on address 0x7f564317a4c8 at pc 0x7f56663d9456 bp 0x7fff810a54f0 sp 0x7fff810a54e8
READ of size 4 at 0x7f564317a4c8 thread T0
#0 0x7f56663d9455 in gfxShapedWord::CompressedGlyph::IsClusterStart() const ../../dist/include/gfxFont.h:1920
#1 0x7f56663225e9 in gfxTextRun::IsClusterStart(unsigned int) ../../dist/include/gfxFont.h:2383
#2 0x7f5666377101 in CountCharsFit(gfxTextRun*, unsigned int, unsigned int, double, PropertyProvider*, double*) layout/generic/nsTextFrameThebes.cpp:6128
#3 0x7f5666375ac4 in nsTextFrame::GetCharacterOffsetAtFramePointInternal(nsPoint const&, bool) layout/generic/nsTextFrameThebes.cpp:6171
#4 0x7f5666375047 in nsTextFrame::CalcContentOffsetsFromFramePoint(nsPoint) layout/generic/nsTextFrameThebes.cpp:6144
#5 0x7f5665f6051d in nsIFrame::GetContentOffsetsFromPoint(nsPoint, unsigned int) layout/generic/nsFrame.cpp:3643
#6 0x7f5665f5cde3 in nsFrame::HandlePress(nsPresContext*, nsGUIEvent*, nsEventStatus*) layout/generic/nsFrame.cpp:2714
#7 0x7f5665f56c27 in nsFrame::HandleEvent(nsPresContext*, nsGUIEvent*, nsEventStatus*) layout/generic/nsFrame.cpp:2401
#8 0x7f5665c259ae in nsPresShellEventCB::HandleEvent(nsEventChainPostVisitor&) layout/base/nsPresShell.cpp:492
#9 0x7f5668432cc3 in nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor&, unsigned int, nsDispatchingCallback*, bool, nsCxPusher*) content/events/src/nsEventDispatcher.cpp:362
#10 0x7f5668437f82 in nsEventDispatcher::Dispatch(nsISupports*, nsPresContext*, nsEvent*, nsIDOMEvent*, nsEventStatus*, nsDispatchingCallback*, nsCOMArray<nsIDOMEventTarget>*) content/events/src/nsEventDispatcher.cpp:629
#11 0x7f5665be315f in PresShell::HandleEventInternal(nsEvent*, nsEventStatus*) layout/base/nsPresShell.cpp:6474
#12 0x7f5665bdce63 in PresShell::HandlePositionedEvent(nsIFrame*, nsGUIEvent*, nsEventStatus*) layout/base/nsPresShell.cpp:6223
#13 0x7f5665bd4dbf in PresShell::HandleEvent(nsIFrame*, nsGUIEvent*, bool, nsEventStatus*) layout/base/nsPresShell.cpp:6022
#14 0x7f56699dc0f9 in nsViewManager::DispatchEvent(nsGUIEvent*, nsIView*, nsEventStatus*) view/src/nsViewManager.cpp:771
#15 0x7f56699c7817 in nsView::HandleEvent(nsGUIEvent*, bool) view/src/nsView.cpp:1068
#16 0x7f56699c7be1 in non-virtual thunk to nsView::HandleEvent(nsGUIEvent*, bool) :?
#17 0x7f566f348c7a in nsWindow::DispatchEvent(nsGUIEvent*, nsEventStatus&) widget/gtk2/nsWindow.cpp:458
#18 0x7f566f37c3b1 in nsWindow::OnButtonPressEvent(_GtkWidget*, _GdkEventButton*) widget/gtk2/nsWindow.cpp:2729
#19 0x7f566f393349 in button_press_event_cb(_GtkWidget*, _GdkEventButton*) widget/gtk2/nsWindow.cpp:5256
#20 0x7f566020cdd7 in ?? ??:0
0x7f564317a4c8 is located 0 bytes to the right of 136-byte region [0x7f564317a440,0x7f564317a4c8)
allocated by thread T0 here:
#0 0x4c3e10 in malloc ??:?
#1 0x7f5680d4b866 in moz_malloc memory/mozalloc/mozalloc.cpp:64
#2 0x7f56721dffbb in gfxTextRun::AllocateStorageForTextRun(unsigned long, unsigned int) gfx/thebes/gfxFont.cpp:4469
#3 0x7f56721c30dd in gfxTextRun::Create(gfxTextRunFactory::Parameters const*, unsigned int, gfxFontGroup*, unsigned int) gfx/thebes/gfxFont.cpp:4486
#4 0x7f56721c69f9 in gfxFontGroup::MakeTextRun(unsigned char const*, unsigned int, gfxTextRunFactory::Parameters const*, unsigned int) gfx/thebes/gfxFont.cpp:3531
#5 0x7f5666308b9e in gfxTextRun* MakeTextRun<unsigned char>(unsigned char const*, unsigned int, gfxFontGroup*, gfxTextRunFactory::Parameters const*, unsigned int) layout/generic/nsTextFrameThebes.cpp:552
#6 0x7f56662fd9fb in BuildTextRunsScanner::BuildTextRunForFrames(void*) layout/generic/nsTextFrameThebes.cpp:2049
#7 0x7f56662f2977 in BuildTextRunsScanner::FlushFrames(bool, bool) layout/generic/nsTextFrameThebes.cpp:1408
#8 0x7f5666316a21 in BuildTextRuns(gfxContext*, nsTextFrame*, nsIFrame*, nsLineList_iterator const*, nsTextFrame::TextRunType) layout/generic/nsTextFrameThebes.cpp:1336
Shadow byte and word:
0x1feac862f499: fb
0x1feac862f498: 00 fb fb fb fb fb fb fb
More shadow bytes:
0x1feac862f478: fd fd fd fd fd fd fd fd
0x1feac862f480: fa fa fa fa fa fa fa fa
0x1feac862f488: 00 00 00 00 00 00 00 00
0x1feac862f490: 00 00 00 00 00 00 00 00
=>0x1feac862f498: 00 fb fb fb fb fb fb fb
0x1feac862f4a0: fa fa fa fa fa fa fa fa
0x1feac862f4a8: fd fd fd fd fd fd fd fd
0x1feac862f4b0: fd fd fd fd fd fd fd fd
0x1feac862f4b8: fd fd fd fd fd fd fd fd
Stats: 268M malloced (261M for red zones) by 537106 calls
Stats: 44M realloced by 25642 calls
Stats: 237M freed by 307654 calls
Stats: 204M really freed by 253059 calls
Stats: 265M (67958 full pages) mmaped in 507 calls
mmaps by size class: 7:221130; 8:47081; 9:13299; 10:6643; 11:7650; 12:1664; 13:896; 14:544; 15:144; 16:680; 17:452; 18:134; 19:35; 20:21;
mallocs by size class: 7:380809; 8:92863; 9:25780; 10:10928; 11:16758; 12:3095; 13:1929; 14:1723; 15:343; 16:1260; 17:1370; 18:183; 19:42; 20:23;
frees by size class: 7:193336; 8:64604; 9:19790; 10:7821; 11:13658; 12:2141; 13:1717; 14:1555; 15:289; 16:1173; 17:1353; 18:158; 19:39; 20:20;
rfrees by size class: 7:163685; 8:49891; 9:15630; 10:4663; 11:12235; 12:1530; 13:1333; 14:1345; 15:244; 16:1098; 17:1289; 18:61; 19:37; 20:18;
Stats: malloc large: 3221 small slow: 5781
==18316== ABORTING
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 Graphics. Mozilla made it public on 4 November 2012 as CVE-2012-5839.
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.