[Piglit] [PATCH 1/4] fbo-drawbuffers-maxtargets: fix a warning

Timothy Arceri tarceri at itsqueeze.com
Sat Sep 15 03:04:41 UTC 2018


On 14/9/18 4:10 am, Nicolai Hähnle wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
> 
> Ensure that the allocated buffer is guaranteed to be big enough.
> ---
>   tests/fbo/fbo-drawbuffers-maxtargets.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/fbo/fbo-drawbuffers-maxtargets.c b/tests/fbo/fbo-drawbuffers-maxtargets.c
> index f5e2a48ed..5d5a09f62 100644
> --- a/tests/fbo/fbo-drawbuffers-maxtargets.c
> +++ b/tests/fbo/fbo-drawbuffers-maxtargets.c
> @@ -137,21 +137,21 @@ generate_and_display_drawbuffers(int count)
>   
>   	glDrawBuffersARB(count, attachments);
>   
>   	/* Clear all to red so we see if the shader rendering happens. */
>   	glClearColor(1.0, 0.0, 0.0, 0.0);
>   	glClear(GL_COLOR_BUFFER_BIT);
>   
>   	/* Build the shader that writes different color to each buffer. */
>   	vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_source);
>   
> -	fs_count_source = malloc(strlen(fs_source) + 5);
> +	fs_count_source = malloc(strlen(fs_source) + 10);

max_targets is clamped to 16 so it's not really needed is it?

I guess it won't hurt though.

Acked-by: Timothy Arceri <tarceri at itsqueeze.com>

>   	sprintf(fs_count_source, fs_source, count);
>   	fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_count_source);
>   	free(fs_count_source);
>   
>   	prog = piglit_link_simple_program(vs, fs);
>   	glUseProgram(prog);
>   
>   	if (!piglit_check_gl_error(GL_NO_ERROR))
>   		piglit_report_result(PIGLIT_FAIL);
>   
> 


More information about the Piglit mailing list