[Mesa-dev] [PATCH] st/mesa: check for zero-size image in st_TestProxyTexImage()

Jose Fonseca jfonseca at vmware.com
Mon Sep 24 06:52:18 PDT 2012


Looks good. Thanks Brian.

Jose

----- Original Message -----
> Fixes divide by zero issue in llvmpipe driver.
> ---
>  src/mesa/state_tracker/st_cb_texture.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/src/mesa/state_tracker/st_cb_texture.c
> b/src/mesa/state_tracker/st_cb_texture.c
> index 4f4fe77..5634a3e 100644
> --- a/src/mesa/state_tracker/st_cb_texture.c
> +++ b/src/mesa/state_tracker/st_cb_texture.c
> @@ -1379,6 +1379,11 @@ st_TestProxyTexImage(struct gl_context *ctx,
> GLenum target,
>     struct st_context *st = st_context(ctx);
>     struct pipe_context *pipe = st->pipe;
>  
> +   if (width == 0 || height == 0 || depth == 0) {
> +      /* zero-sized images are legal, and always fit! */
> +      return GL_TRUE;
> +   }
> +
>     if (pipe->screen->can_create_resource) {
>        /* Ask the gallium driver if the texture is too large */
>        struct gl_texture_object *texObj =
> --
> 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