Skip to content
Memory corruption Disclosed report CVE-2015-7180

Mishandling return status in ReadbackResultWriterD3D11::Run might cause memory-safety bug

q1 Follow

Originally disclosed on Mozilla

  • Fixed in 18 days
  • Paid in 19 days
  • Disclosed after 18 days
Text
ReadbackResultWriterD3D11::Run (gfx\layers\d3d11\ReadbackManagerD3D11.cpp) mishandles failure status from ID3D10Texture2D::Map. This might cause it to use a pointer and other data from uninitialized memory to create a surface, which is then used to read (and possibly write?) data from/to memory:

41:  NS_IMETHODIMP Run()
42:  {
43:    D3D10_TEXTURE2D_DESC desc;
44:    mTask->mReadbackTexture->GetDesc(&desc);
45:
46:    D3D10_MAPPED_TEXTURE2D mappedTex;
47:    // We know this map will immediately succeed, as we've already mapped this
48:    // copied data on our task thread.
49:    HRESULT hr = mTask->mReadbackTexture->Map(0, D3D10_MAP_READ, 0, &mappedTex);
50:
51:    if (FAILED(hr)) {
52:      mTask->mSink->ProcessReadback(nullptr);
53:    }
54:
55:    {
56:      RefPtr<DataSourceSurface> surf =
57:        Factory::CreateWrappingDataSourceSurface((uint8_t*)mappedTex.pData, mappedTex.RowPitch,
58:                                                 IntSize(desc.Width, desc.Height),
59:                                                 SurfaceFormat::B8G8R8X8);
60:
61:      mTask->mSink->ProcessReadback(surf);
62:
63:      MOZ_ASSERT(surf->hasOneRef());
64:    }
65:
66:    mTask->mReadbackTexture->Unmap(0);
67:
68:    return NS_OK;
69:  }

First lines 47-8 assert that Map cannot fail, but then lines 51-3 attempt to handle failure. However, they do so imcompletely (should there be a "return <some status>;" following line 52? Or has an "else" accidentally been elided from line 54?) leaving lines 57-9 using the uninitialized struct mappedTex. Despite the comments on line 47-8, probably OOM, device failure, and possibly other conditions can cause Map to fail even under the conditions under which Run runs.

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 high-severity memory corruption bug in Graphics. Mozilla made it public on 23 August 2015 as CVE-2015-7180.

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.