Commit b2bdd06c by apatrick@chromium.org

Fixed NULL dereference in glClear.

6 crashes on Windows XP 1 crash on Windows 7 This was Canary 7.0.530.0 using ANGLE r429. 0x011f523b [libGLESv2.dll - context.cpp:2412] gl::Context::clear(unsigned int) 0x011e5f41 [libGLESv2.dll - libglesv2.cpp:611] glClear 0x020c400d [chrome.dll - gl_context.cc:33] gfx::GLContext::InitializeCommon() 0x020bb757 [chrome.dll - gl_context_egl.cc:138] gfx::NativeViewEGLContext::Initialize() 0x020b8946 [chrome.dll - gl_context_win.cc:502] gfx::GLContext::CreateViewGLContext(HWND__ *,bool) 0x01c4f6f8 [chrome.dll - gpu_processor_win.cc:35] gpu::GPUProcessor::Initialize(HWND__ *,gfx::Size const &,gpu::GPUProcessor *,unsigned int) 0x01d6e669 [chrome.dll - gpu_command_buffer_stub.cc:88] GpuCommandBufferStub::OnInitialize(int,void * *) It's crashing upon creation of the GL context, possibly the first context. Device lost would possibly explain the XP crashes. The Windows 7 box might have run out of video memory. I also checked another couple of NULL dereference crashes. Review URL: http://codereview.appspot.com/2197046 git-svn-id: https://angleproject.googlecode.com/svn/trunk@444 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 4888ceb6
...@@ -1614,11 +1614,23 @@ bool Context::applyRenderTarget(bool ignoreViewport) ...@@ -1614,11 +1614,23 @@ bool Context::applyRenderTarget(bool ignoreViewport)
if (framebufferObject->getDepthbufferType() != GL_NONE) if (framebufferObject->getDepthbufferType() != GL_NONE)
{ {
depthStencil = framebufferObject->getDepthbuffer()->getDepthStencil(); depthStencil = framebufferObject->getDepthbuffer()->getDepthStencil();
if (!depthStencil)
{
ERR("Depth stencil pointer unexpectedly null.");
return false;
}
depthbufferSerial = framebufferObject->getDepthbuffer()->getSerial(); depthbufferSerial = framebufferObject->getDepthbuffer()->getSerial();
} }
else if (framebufferObject->getStencilbufferType() != GL_NONE) else if (framebufferObject->getStencilbufferType() != GL_NONE)
{ {
depthStencil = framebufferObject->getStencilbuffer()->getDepthStencil(); depthStencil = framebufferObject->getStencilbuffer()->getDepthStencil();
if (!depthStencil)
{
ERR("Depth stencil pointer unexpectedly null.");
return false;
}
stencilbufferSerial = framebufferObject->getStencilbuffer()->getSerial(); stencilbufferSerial = framebufferObject->getStencilbuffer()->getSerial();
} }
...@@ -2415,6 +2427,12 @@ void Context::clear(GLbitfield mask) ...@@ -2415,6 +2427,12 @@ void Context::clear(GLbitfield mask)
if (framebufferObject->getStencilbufferType() != GL_NONE) if (framebufferObject->getStencilbufferType() != GL_NONE)
{ {
IDirect3DSurface9 *depthStencil = framebufferObject->getStencilbuffer()->getDepthStencil(); IDirect3DSurface9 *depthStencil = framebufferObject->getStencilbuffer()->getDepthStencil();
if (!depthStencil)
{
ERR("Depth stencil pointer unexpectedly null.");
return;
}
D3DSURFACE_DESC desc; D3DSURFACE_DESC desc;
depthStencil->GetDesc(&desc); depthStencil->GetDesc(&desc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment