[Mesa-dev] [PATCH] mesa/objectlabel: don't do memcpy if bufSize is 0

Dave Airlie airlied at gmail.com
Tue May 3 07:33:22 UTC 2016


From: Dave Airlie <airlied at redhat.com>

This prevents GL43-CTS.khr_debug.labels_non_debug from
memcpying all over the stack, it doesn't fix the test,
but it stops the crash.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/mesa/main/objectlabel.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c
index b622d6a..cce956e 100644
--- a/src/mesa/main/objectlabel.c
+++ b/src/mesa/main/objectlabel.c
@@ -104,6 +104,11 @@ copy_label(const GLchar *src, GLchar *dst, GLsizei *length, GLsizei bufSize)
     * will be returned in <length>."
     */
 
+   if (bufSize == 0) {
+      if (length)
+         *length = 0;
+      return;
+   }
    if (src)
       labelLen = strlen(src);
 
-- 
2.5.5



More information about the mesa-dev mailing list