You are right, it doesn't free old shader source. Should we also clear
old source if new source is NULL? Then I could unify both conditions.
On 04.05.2017 19:03, Eric Anholt wrote:
Bartosz Tomczyk <[email protected]> writes:
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;
+
I think this doesn't clear out the shader source when it should. Maybe
shader_source(sh, calloc(1, 1)); before returning?
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev