Bartosz Tomczyk <bartosz.tomczy...@gmail.com> 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?

Attachment: signature.asc
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to