From: Brian Paul Date: Sat, 14 Sep 2013 16:09:24 +0000 (-0600) Subject: mesa: check for bufSize > 0 in _mesa_GetSynciv() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6659131be3bde0505a85e3a7d27382b273822bee;p=mesa.git mesa: check for bufSize > 0 in _mesa_GetSynciv() The spec doesn't say GL_INVALID_VALUE should be raised for bufSize <= 0. In any case, memcpy(len < 0) will lead to a crash, so don't allow it. CC: "9.2" Reviewed-by: Ian Romanick --- diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c index 27867a13775..ad21f3b670a 100644 --- a/src/mesa/main/syncobj.c +++ b/src/mesa/main/syncobj.c @@ -418,7 +418,7 @@ _mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, return; } - if (size > 0) { + if (size > 0 && bufSize > 0) { const GLsizei copy_count = MIN2(size, bufSize); memcpy(values, v, sizeof(GLint) * copy_count);