[Piglit] [PATCH 04/11] shader_runner: Add missing terminators for string_to_enum arrays

Ian Romanick idr at freedesktop.org
Mon Sep 8 14:34:49 PDT 2014


From: Ian Romanick <ian.d.romanick at intel.com>

If an unknown enum string were specified, lookup_enum_string would read
past the end of the array.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 tests/shaders/shader_runner.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 897edec..a685137 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -1718,12 +1718,14 @@ struct string_to_enum hint_target_table[] = {
 	ENUM_STRING(GL_POLYGON_SMOOTH_HINT),
 	ENUM_STRING(GL_TEXTURE_COMPRESSION_HINT),
 	ENUM_STRING(GL_FRAGMENT_SHADER_DERIVATIVE_HINT),
+	{ NULL, 0 }
 };
 
 struct string_to_enum hint_param_table[] = {
 	ENUM_STRING(GL_FASTEST),
 	ENUM_STRING(GL_NICEST),
 	ENUM_STRING(GL_DONT_CARE),
+	{ NULL, 0 }
 };
 
 void do_hint(const char *line)
@@ -1838,6 +1840,7 @@ handle_texparameter(const char *line)
 		{ "green", GL_GREEN },
 		{ "blue", GL_BLUE },
 		{ "alpha", GL_ALPHA },
+		{ NULL, 0 }
 	};
 	GLenum target = 0;
 	GLenum parameter = GL_NONE;
-- 
1.8.1.4



More information about the Piglit mailing list