[Piglit] [PATCH v3] shader_runner: make buffer large enough to fit any GL enum

Brian Paul brianp at vmware.com
Thu Mar 2 17:23:11 UTC 2017


On 03/02/2017 10:03 AM, Sandra Koroniewska wrote:
> This fixes a buffer overflow in spec/arb_shader_image_load_store/execution/disable_early_z.shader_test
> ---
>   tests/shaders/shader_runner.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
> index 89e6e0a5a..bbc181724 100644
> --- a/tests/shaders/shader_runner.c
> +++ b/tests/shaders/shader_runner.c
> @@ -2821,7 +2821,7 @@ piglit_display(void)
>   		double d[4];
>   		int x, y, z, w, h, l, tex, level;
>   		unsigned ux, uy;
> -		char s[32];
> +		char s[73]; // 73 for longest possible content (gl_framebuffer_incomplete_insufficient_shader_combined_local_storage_ext)
>   		enum piglit_result result = PIGLIT_PASS;
>
>   		parse_whitespace(next_line, &line);
>

Why not bump it up to something like 1000 to be safer?

Does sscanf have a format specifier to limit the number of chars put 
into the string/array?

-Brian



More information about the Piglit mailing list