[Piglit] [PATCH v2 1/2] test: fix core dump for depthstencil-render-miplevels

Sergii Romantsov sergii.romantsov at gmail.com
Mon Jan 14 10:51:34 UTC 2019


Usage test 'depthstencil-render-miplevels 200 s=z24_s8' causes
core dump on exit.
Fixed: array of pointers is allocated to size max_miplevel, but
used as max_miplevel + 1.

CC: Eric Anholt <eric at anholt.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108819
Fixes: 7a0e61d7792f (depthstencil-render-miplevels: Present the results in non-auto mode.)
Signed-off-by: Sergii Romantsov <sergii.romantsov at globallogic.com>
---
 tests/texturing/depthstencil-render-miplevels.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/texturing/depthstencil-render-miplevels.cpp b/tests/texturing/depthstencil-render-miplevels.cpp
index 87af92f..9d4b42d 100644
--- a/tests/texturing/depthstencil-render-miplevels.cpp
+++ b/tests/texturing/depthstencil-render-miplevels.cpp
@@ -360,8 +360,8 @@ piglit_init(int argc, char **argv)
 	piglit_require_extension("GL_ARB_depth_texture");
 	piglit_require_extension("GL_ARB_texture_non_power_of_two");
 
-	depth_miplevel_data = (float **)calloc(max_miplevel, sizeof(float *));
-	stencil_miplevel_data = (uint8_t **)calloc(max_miplevel,
+	depth_miplevel_data = (float **)calloc(max_miplevel + 1, sizeof(float *));
+	stencil_miplevel_data = (uint8_t **)calloc(max_miplevel + 1,
 						   sizeof(uint8_t *));
 
 	/* argv[2]: buffer combination */
-- 
2.7.4



More information about the Piglit mailing list