[Mesa-dev] [PATCH] gallivm: fix crash in lp_sampler_static_state()

Jose Fonseca jfonseca at vmware.com
Fri Aug 10 08:38:36 PDT 2012


Is a view with a NULL texture really possible?

Otherwise 

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>

Jose

----- Original Message -----
> Fixes WebGL conformance/uniforms/uniform-default-values.html crash.
> 
> We need to check for the null view pointer before accessing
> view->texture.
> 
> Fixes http://bugs.freedesktop.org/show_bug.cgi?id=53317
> 
> Note: This is a candidate for the 8.0 branch.
> ---
>  src/gallium/auxiliary/gallivm/lp_bld_sample.c |    7 +++----
>  1 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
> b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
> index 1ea59ea..63cf610 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c
> @@ -96,15 +96,14 @@ lp_sampler_static_state(struct
> lp_sampler_static_state *state,
>                          const struct pipe_sampler_view *view,
>                          const struct pipe_sampler_state *sampler)
>  {
> -   const struct pipe_resource *texture = view->texture;
> +   const struct pipe_resource *texture;
>  
>     memset(state, 0, sizeof *state);
>  
> -   if(!texture)
> +   if (!sampler || !view || !view->texture)
>        return;
>  
> -   if(!sampler)
> -      return;
> +   texture = view->texture;
>  
>     /*
>      * We don't copy sampler state over unless it is actually
>      enabled, to avoid
> --
> 1.7.3.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 


More information about the mesa-dev mailing list