summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <thomas.stellard@amd.com>2013-12-02 21:04:58 -0500
committerIan Romanick <ian.d.romanick@intel.com>2013-12-09 17:28:15 -0800
commit4cbd4246315314cbd6e9c93013f93363a1a376cb (patch)
treea1cfe7e15201ef1bd1a1cea363529d34cd8c4ee0
parent331a8a35864c2aae808ed49ae3dfe3d58a49db6e (diff)
r300/compiler/tests: Fix line length check in test parser
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> CC: "9.2" "10.0" <mesa-stable@lists.freedesktop.org> (cherry picked from commit 9a5ce0c4c971a8511574e10dd3ef37eebbe65ce7)
-rw-r--r--src/gallium/drivers/r300/compiler/tests/rc_test_helpers.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gallium/drivers/r300/compiler/tests/rc_test_helpers.c b/src/gallium/drivers/r300/compiler/tests/rc_test_helpers.c
index af7b3cee48f..b4e30d8a872 100644
--- a/src/gallium/drivers/r300/compiler/tests/rc_test_helpers.c
+++ b/src/gallium/drivers/r300/compiler/tests/rc_test_helpers.c
@@ -542,6 +542,7 @@ unsigned load_program(
char **string_store;
unsigned i = 0;
+ memset(line, 0, sizeof(line));
snprintf(path, MAX_PATH_LENGTH, "compiler/tests/%s", filename);
file = fopen(path, "r");
if (!file) {
@@ -552,7 +553,8 @@ unsigned load_program(
count = &test->num_input_lines;
while (fgets(line, MAX_LINE_LENGTH, file)){
- if (line[MAX_LINE_LENGTH - 2] == '\n') {
+ char last_char = line[MAX_LINE_LENGTH - 1];
+ if (last_char && last_char != '\n') {
fprintf(stderr, "Error line cannot be longer than 100 "
"characters:\n%s\n", line);
return 0;