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

Tapani Pälli tapani.palli at intel.com
Tue Jan 15 13:06:14 UTC 2019


On 1/14/19 12:51 PM, Sergii Romantsov wrote:
> 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.

Yep, it seems valgrind outputs bunch of invalid reads and writes with 
this test.

Alternatively I guess one could change those loops to not exceed max 
level, use < operator instead of <= (?) I'm not sure if other 
calculations would match so some careful investigation would be required 
there. It just seems a bit strange to first calculate a 'maximum' 
miplevel but then use even bigger value in the test :)


> 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 */
> 


More information about the Piglit mailing list