The multisampling tests initialize the number of miplevels to the number
of samples.  Since this is zero, we allocate an array of zero miplevels,
and then try to write to the first element.

Fixes the following Valgrind error:

Invalid write of size 8
   at 0x403123: compute_miplevel_info (common.c:163)
   by 0x402B9B: piglit_init (textureSize.c:455)
   by 0x4EA6B89: run_test (piglit_fbo_framework.c:50)
   by 0x4EA4BEE: piglit_gl_test_run (piglit-framework-gl.c:141)
   by 0x401FC7: main (textureSize.c:68)
 Address 0xa04d040 is 0 bytes after a block of size 0 alloc'd
   at 0x4C2757B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x40310A: compute_miplevel_info (common.c:161)
   by 0x402B9B: piglit_init (textureSize.c:455)
   by 0x4EA6B89: run_test (piglit_fbo_framework.c:50)
   by 0x4EA4BEE: piglit_gl_test_run (piglit-framework-gl.c:141)
   by 0x401FC7: main (textureSize.c:68)

Signed-off-by: Kenneth Graunke <[email protected]>
Cc: Chris Forbes <[email protected]>
---
 tests/texturing/shaders/textureSize.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/texturing/shaders/textureSize.c 
b/tests/texturing/shaders/textureSize.c
index f010d9c..85a11d3 100644
--- a/tests/texturing/shaders/textureSize.c
+++ b/tests/texturing/shaders/textureSize.c
@@ -432,6 +432,8 @@ piglit_init(int argc, char **argv)
        int prog;
        int tex_location;
 
+       sample_count = 1;
+
        require_GL_features(test_stage);
 
        if (sampler.target == GL_TEXTURE_CUBE_MAP_ARRAY)
-- 
1.8.3.4

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to