mesa: Prevent possible out-of-bounds read by save_SamplerParameterfv.
authorVinson Lee <vlee@freedesktop.org>
Mon, 3 Jun 2013 06:16:42 +0000 (23:16 -0700)
committerVinson Lee <vlee@freedesktop.org>
Tue, 4 Jun 2013 06:01:46 +0000 (23:01 -0700)
Fixes "Out-of-bounds access" defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/main/dlist.c

index c37b15ee64be1f144e2a8a12bb6892034bb90699..18e3eb7603726746f89a75a0f8d9ece4fbf288d1 100644 (file)
@@ -7056,7 +7056,10 @@ save_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
 static void GLAPIENTRY
 save_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
 {
-   save_SamplerParameterfv(sampler, pname, &param);
+   GLfloat parray[4];
+   parray[0] = param;
+   parray[1] = parray[2] = parray[3] = 0.0F;
+   save_SamplerParameterfv(sampler, pname, parray);
 }
 
 static void GLAPIENTRY