Protect against invalid buffers being bound to GL

* Should fix a reported crash - it looks like an invalid buffer ID was
  passed, and there's no protection for this.
* As with other invalid API use, RenderDoc isn't intended to be totally
  safe against bad API use. This check is easy to add though and should
  catch some simple cases.
This commit is contained in:
baldurk
2017-01-04 16:54:33 +00:00
parent 07fd9c8e0c
commit 079cc7a8db
@@ -233,6 +233,13 @@ void WrappedOpenGL::glBindBuffer(GLenum target, GLuint buffer)
GLResourceRecord *r = cd.m_BufferRecord[idx] =
GetResourceManager()->GetResourceRecord(BufferRes(GetCtx(), buffer));
if(!r)
{
RDCERR("Invalid/unrecognised buffer passed: glBindBuffer(%s, %u)", ToStr::Get(target).c_str(),
buffer);
return;
}
// it's legal to re-type buffers, generate another BindBuffer chunk to rename
if(r->datatype != target)
{