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

Nicolai Hähnle nhaehnle at gmail.com
Thu Sep 13 18:10:46 UTC 2018


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);
 	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);
 
-- 
2.17.1



More information about the Piglit mailing list