built-in-constants relies on a file being passed to it describing the tests to run. If this file does not exist the program will segfault. This patch adds the appropriate check after calling piglit_load_text_file to check for a NULL value and fail if it is.
Signed-off-by: Dylan Baker <[email protected]> --- tests/shaders/built-in-constants.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/shaders/built-in-constants.c b/tests/shaders/built-in-constants.c index 0bfe2c1..5d4bc69 100644 --- a/tests/shaders/built-in-constants.c +++ b/tests/shaders/built-in-constants.c @@ -191,6 +191,11 @@ parse_file(const char *filename) char *end_of_line; ptrdiff_t len; + if (line == NULL) { + fprintf(stderr, "could not read file \"%s\"\n", filename); + piglit_report_result(PIGLIT_FAIL); + } + /* The format of the test file is: * * major.minor -- 2.1.0 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
