[Mesa-dev] [PATCH] mesa: Prevent possible out-of-bounds read by save_SamplerParameteriv.

Brian Paul brianp at vmware.com
Thu Jun 6 08:35:23 PDT 2013


On 06/05/2013 11:05 PM, Vinson Lee wrote:
> Fixes "Out-of-bounds access" defect reported by Coverity.
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>   src/mesa/main/dlist.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
> index abc8665..8900c89 100644
> --- a/src/mesa/main/dlist.c
> +++ b/src/mesa/main/dlist.c
> @@ -7024,7 +7024,10 @@ save_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
>   static void GLAPIENTRY
>   save_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
>   {
> -   save_SamplerParameteriv(sampler, pname, &param);
> +   GLint parray[4];
> +   parray[0] = param;
> +   parray[1] = parray[2] = parray[3] = 0;
> +   save_SamplerParameteriv(sampler, pname, param);
>   }
>
>   static void GLAPIENTRY
>

Reviewed-by: Brian Paul <brianp at vmware.com>


More information about the mesa-dev mailing list