Skip to content
Memory corruption Disclosed report

TextRenderer::RenderText using uninitialized memory

q1 Follow

Originally disclosed on Mozilla

  • Fixed in 7 days
  • Paid in 25 days
  • Disclosed after 7 days
Text
User Agent: Mozilla/5.0 (Windows; rv:26.0) Gecko/20100101 Firefox/26.0
Build ID: 20150305021524

Steps to reproduce:

In Firefox 38.0.1, TextRenderer::RenderText uses uninitialized memory at gfx\layers\composite\TextRenderer.cpp line 96 et seq.

The problem is that TextRenderer::RenderText does not check the return value from DataSourceSurface::Map at line 93, thus (on failure and for some derived classes of DataSourceSurface, e.g., DataSourceSurfaceD2D) leaving untouched whatever was contained in the uninitialized variable map:

 92: DataSourceSurface::MappedSurface map;
 93: textSurf->Map(DataSourceSurface::MapType::READ_WRITE, &map);
 94:
 95: // Initialize the surface to transparent white.
 96: memset(map.mData, uint8_t(sBackgroundOpacity * 255.0f),
 97:        numLines * sCellHeight * map.mStride);
 98:
 99:  uint32_t currentXPos = 0;
100:  uint32_t currentYPos = 0;
101:
102:  // Copy our glyphs onto the surface.
  ...
115:  memcpy (map.mData + ...)

Since map can contain anything, this bug could make it possible to write data into anywhere in Firefox's address space. Depending on how RenderText is used, this bug might be exploitable to disclose sensitive data and/or cause execution of attacker-selected code. Perhaps an attacker could design a font that contains data to be written to the stack such that, when RenderText returns, it passes control to an attacker-designated function.

The original report as published on Mozilla's Bugzilla, by q1. 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 memory corruption bug in Graphics: Text. Mozilla made it public on 28 May 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 q1

View all

71 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.