[Piglit] [PATCH] util: Validate extension string in piglit_is_extension_in_string()
Chad Versace
chad.versace at linux.intel.com
Thu May 3 15:45:44 PDT 2012
If the extension string is not prefixed with "GL_", then fail the test.
This should prevent accidental misuse of the function.
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
tests/util/piglit-util.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c
index 6bde4af..960ee70 100644
--- a/tests/util/piglit-util.c
+++ b/tests/util/piglit-util.c
@@ -145,6 +145,14 @@ bool piglit_is_extension_in_string(const char *haystack, const char *needle)
if (needle_len == 0)
return false;
+ /* Validate needle. */
+ if (strncmp(needle, "GL_", 3) != 0) {
+ fprintf(stderr,
+ "error: extension string \"%s\" must be prefixed with "
+ "\"GL_\"\n", needle);
+ piglit_report_result(PIGLIT_FAIL);
+ }
+
while (true) {
const char *const s = strstr(haystack, needle);
--
1.7.10
More information about the Piglit
mailing list