Mesa (9.2): mesa: check for bufSize > 0 in _mesa_GetSynciv()

Carl Worth cworth at kemper.freedesktop.org
Tue Oct 1 21:13:28 UTC 2013


Module: Mesa
Branch: 9.2
Commit: 2eb55601bbb405bf72555409ede8795abb69d3dd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2eb55601bbb405bf72555409ede8795abb69d3dd

Author: Brian Paul <brianp at vmware.com>
Date:   Sat Sep 14 10:09:24 2013 -0600

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" <mesa-stable at lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
(cherry picked from commit 6659131be3bde0505a85e3a7d27382b273822bee)

---

 src/mesa/main/syncobj.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c
index c8d25cd..4e9b125 100644
--- a/src/mesa/main/syncobj.c
+++ b/src/mesa/main/syncobj.c
@@ -409,7 +409,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);




More information about the mesa-commit mailing list