[Mesa-dev] [PATCH] fix crash: check for _NumLinkedShaders being 0.

Ian Romanick idr at paranormal-entertainment.com
Sun Sep 5 09:48:22 PDT 2010


On Sep 4, 2010, at 3:48 AM, Török Edwin <edwintorok at gmail.com> wrote:

> From: Török Edvin <edwintorok at gmail.com>
>
> Otherwise spring 0.82+.4.0 crashes when starting a game
> because prog->_LinkedShaders[0] is NULL.

Any idea what this app is doing to hit this?  A piglit test would be  
good.

Sent from my phone.

> ---
> src/glsl/linker.cpp |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> index e0823c3..02c7c29 100644
> --- a/src/glsl/linker.cpp
> +++ b/src/glsl/linker.cpp
> @@ -1476,7 +1476,7 @@ link_shaders(GLcontext *ctx, struct  
> gl_shader_program *prog)
>
>    assign_uniform_locations(prog);
>
> -   if (prog->_LinkedShaders[0]->Type == GL_VERTEX_SHADER) {
> +   if (prog->_NumLinkedShaders && prog->_LinkedShaders[0]->Type ==  
> GL_VERTEX_SHADER) {
>       /* FINISHME: The value of the max_attribute_index parameter is
>        * FINISHME: implementation dependent based on the value of
>        * FINISHME: GL_MAX_VERTEX_ATTRIBS.  GL_MAX_VERTEX_ATTRIBS  
> must be
> -- 
> 1.7.1


More information about the mesa-dev mailing list