[Mesa-dev] [PATCH] mesa: return early with no error when shader source count is 0
Bartosz Tomczyk
bartosz.tomczyk86 at gmail.com
Thu May 4 10:13:59 UTC 2017
malloc can return valid pointer for zero size allocation,
which causes OOB access later on
---
src/mesa/main/shaderapi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index c41f006eb7..36cff0ca6e 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1776,6 +1776,9 @@ _mesa_ShaderSource(GLuint shaderObj, GLsizei count,
GLcharARB *source;
struct gl_shader *sh;
+ if (!count)
+ return;
+
sh = _mesa_lookup_shader_err(ctx, shaderObj, "glShaderSourceARB");
if (!sh)
return;
--
2.12.2
More information about the mesa-dev
mailing list