Skip to content
Memory corruption Disclosed report Advanced CVE-2017-5406

SEGV in SkBlitLCD16OpaqueRow_SSE2

A crafted SVG document caused Firefox to crash with a segmentation fault while rendering text, with the fault occurring inside Skia's SSE2 glyph blitting routine. An attacker could use such a page to crash the browser, but the text does not claim any code execution or data exposure.

Atte Kettunen Follow

Originally disclosed on Mozilla

  • Fixed in 43 days
  • Paid in 44 days
  • Disclosed after 43 days

Created attachment 8796864 firefox-SEGV-20f-20f-20f-0f3-2e50-min.html

Tested on:

OS: Ubuntu 16.04.1 LTS

Firefox: ASAN-build moz_source_stamp: f713114b8c8d352b668b3e8052bc51ece4df34e0

prefs.js from https://github.com/MozillaSecurity/fuzzdata/blob/master/settings/firefox/prefs.js

ASAN-trace:

ASAN:DEADLYSIGNAL

==2203==ERROR: AddressSanitizer: SEGV on unknown address 0x11dfdd40f2ff (pc 0x7ffb1f2b6e47 bp 0x7fffa27f3960 sp 0x7fffa27f3930 T0) #0 0x7ffb1f2b6e46 in SkBlitLCD16OpaqueRow_SSE2(unsigned int*, unsigned short const*, unsigned int, int, unsigned int) /home/worker/workspace/build/src/gfx/skia/skia/src/opts/SkBlitRow_opts_SSE2.cpp:459:57 #1 0x7ffb1f356e51 in D32_LCD16_Proc /home/worker/workspace/build/src/gfx/skia/skia/src/core/SkBlitMask_D32.cpp:46:9 #2 0x7ffb1f356e51 in SkBlitMask::BlitColor(SkPixmap const&, SkMask const&, SkIRect const&, unsigned int) /home/worker/workspace/build/src/gfx/skia/skia/src/core/SkBlitMask_D32.cpp:67 #3 0x7ffb1f14be95 in SkARGB32_Opaque_Blitter::blitMask(SkMask const&, SkIRect const&) /home/worker/workspace/build/src/gfx/skia/skia/src/core/SkBlitter_ARGB32.cpp:188:9 #4 0x7ffb1f64ede2 in DrawOneGlyph::blitMask(SkMask const&, SkIRect const&) const /home/worker/workspace/build/src/gfx/skia/skia/src/core/SkDraw.cpp:1551:13 #5 0x7ffb1f64e540 in DrawOneGlyph::operator()(SkGlyph const&, SkPoint, SkPoint) /home/worker/workspace/build/src/gfx/skia/skia/src/core/SkDraw.cpp:1511:17 #6 0x7ffb1f6512dd in SkFindAndPlaceGlyph::GlyphFindAndPlaceFullPixel<DrawOneGlyph&, (SkPaint::Align)0, (SkFindAndPlaceGlyph::SelectKerning)0>::findAndPositionGlyph(char const**, SkPoint, DrawOneGlyph&) /home/w orker/workspace/build/src/gfx/skia/skia/src/core/SkFindAndPlaceGlyph.h:504:17 #7 0x7ffb1f6479bb in void SkFindAndPlaceGlyph::ProcessPosText<DrawOneGlyph&>(SkPaint::TextEncoding, char const*, unsigned long, SkPoint, SkMatrix const&, float const*, int, SkPaint::Align, SkGlyphCache*, DrawO neGlyph&) /home/worker/workspace/build/src/gfx/skia/skia/src/core/SkFindAndPlaceGlyph.h:685:9 #8 0x7ffb1f646906 in SkDraw::drawPosText(char const*, unsigned long, float const*, int, SkPoint const&, SkPaint const&) const /home/worker/workspace/build/src/gfx/skia/skia/src/core/SkDraw.cpp:1676:5 #9 0x7ffb1f3351ba in SkBitmapDevice::drawPosText(SkDraw const&, void const*, unsigned long, float const*, int, SkPoint const&, SkPaint const&) /home/worker/workspace/build/src/gfx/skia/skia/src/core/SkBitmapDe vice.cpp:345:5 #10 0x7ffb1f38c0b0 in SkCanvas::onDrawPosText(void const*, unsigned long, SkPoint const*, SkPaint const&) /home/worker/workspace/build/src/gfx/skia/skia/src/core/SkCanvas.cpp:2576:9 #11 0x7ffb1f38e33f in SkCanvas::drawPosText(void const*, unsigned long, SkPoint const*, SkPaint const&) /home/worker/workspace/build/src/gfx/skia/skia/src/core/SkCanvas.cpp:2651:5 #12 0x7ffb17965856 in mozilla::gfx::DrawTargetSkia::FillGlyphs(mozilla::gfx::ScaledFont*, mozilla::gfx::GlyphBuffer const&, mozilla::gfx::Pattern const&, mozilla::gfx::DrawOptions const&, mozilla::gfx::GlyphRe nderingOptions const*) /home/worker/workspace/build/src/gfx/2d/DrawTargetSkia.cpp:1328:3 #13 0x7ffb18032bed in GlyphBufferAzure::Flush(bool) /home/worker/workspace/build/src/gfx/thebes/gfxFont.cpp:1666:21 #14 0x7ffb17ffd9e3 in ~GlyphBufferAzure /home/worker/workspace/build/src/gfx/thebes/gfxFont.cpp:1569:9 #15 0x7ffb17ffd9e3 in gfxFont::DrawGlyphs(gfxShapedText const*, unsigned int, unsigned int, gfxPoint*, TextRunDrawParams const&, FontDrawParams const&) /home/worker/workspace/build/src/gfx/thebes/gfxFont.cpp:1 968 #16 0x7ffb1800156b in gfxFont::Draw(gfxTextRun const*, unsigned int, unsigned int, gfxPoint*, TextRunDrawParams const&, unsigned short) /home/worker/workspace/build/src/gfx/thebes/gfxFont.cpp:2156:9 #17 0x7ffb18070b4d in gfxTextRun::DrawGlyphs(gfxFont*, gfxTextRun::Range, gfxPoint*, gfxTextRun::PropertyProvider*, gfxTextRun::Range, TextRunDrawParams&, unsigned short) const /home/worker/workspace/build/src /gfx/thebes/gfxTextRun.cpp:413:5 #18 0x7ffb18073617 in gfxTextRun::Draw(gfxTextRun::Range, gfxPoint, gfxTextRun::DrawParams const&) const /home/worker/workspace/build/src/gfx/thebes/gfxTextRun.cpp:667:9 #19 0x7ffb1cf2e581 in DrawTextRun(gfxTextRun const*, gfxPoint const&, gfxTextRun::Range, nsTextFrame::DrawTextRunParams const&) /home/worker/workspace/build/src/layout/generic/nsTextFrame.cpp:6835:7 #20 0x7ffb1cf2da56 in nsTextFrame::DrawTextRun(gfxTextRun::Range, gfxPoint const&, nsTextFrame::DrawTextRunParams const&) /home/worker/workspace/build/src/layout/generic/nsTextFrame.cpp:6845:3 #21 0x7ffb1cf231f8 in nsTextFrame::DrawText(gfxTextRun::Range, gfxPoint const&, nsTextFrame::DrawTextParams const&) /home/worker/workspace/build/src/layout/generic/nsTextFrame.cpp:7028:5 #22 0x7ffb1cf16139 in nsTextFrame::PaintText(nsTextFrame::PaintTextParams const&, nsCharClipDisplayItem const&, float) /home/worker/workspace/build/src/layout/generic/nsTextFrame.cpp:6799:3 #23 0x7ffb1d0967b2 in SVGTextFrame::PaintSVG(gfxContext&, gfxMatrix const&, mozilla::gfx::IntRectTypedmozilla::gfx::UnknownUnits const*) /home/worker/workspace/build/src/layout/svg/SVGTextFrame.cpp:3691:9 #24 0x7ffb1d095043 in nsDisplaySVGText::Paint(nsDisplayListBuilder*, nsRenderingContext*) /home/worker/workspace/build/src/layout/svg/SVGTextFrame.cpp:3122:23 . . . AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV /home/worker/workspace/build/src/gfx/skia/skia/src/opts/SkBlitRow_opts_SSE2.cpp:459:57 in SkBlitLCD16OpaqueRow_SSE2(unsigned int*, unsigned short const*, unsigned int, int, unsigned int) ==2203==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.

How it worked

Root cause

Likely a memory-safety flaw in the SSE2 glyph blitting path of Skia, where an out-of-range address is dereferenced while drawing SVG text.

Impact

A crafted page could crash the browser tab or process; the text shows no evidence of code execution or data theft.

What the attacker needed

Victim opens a crafted page; SVG text rendering is triggered

How it was found

  1. Open the attached HTML file in an ASAN build of Firefox.
  2. Load the page so the SVG text is rendered.
  3. Observe the AddressSanitizer SEGV and the browser aborting.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A segmentation fault (SEGV) is when a program tries to read or write memory it is not allowed to touch, so the operating system stops it. Here a specially built web page containing SVG text made Firefox's graphics library, Skia, access a bad memory address while drawing letters, and the browser aborted. The report only shows a crash, not a way to run attacker code.

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.