aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrii Simiklit <[email protected]>2020-06-03 18:59:02 +0300
committerMarge Bot <[email protected]>2020-06-10 03:29:39 +0000
commit2c711beb5ce9fe013d557be71eb986444415b758 (patch)
tree0e8218fbcdf7c7d46e9f9dd31dc0b16f75530a73
parent0c37cbf807f06b6aae1f17c99d653274110bad5d (diff)
glsl: fix crash on glsl macro redefinition
In case shader contains two equal macro defines, first one with trailing spaces and the second one without. `#define A 1 ` `#define A 1` The parser crashes Fixes: 0346ad37741b11d640c1c4970b275c1f0c7f9e75 ("glsl: ignore trailing whitespace when define redefined") Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Andrii Simiklit <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5312>
-rw-r--r--src/compiler/glsl/glcpp/glcpp-parse.y3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/compiler/glsl/glcpp/glcpp-parse.y b/src/compiler/glsl/glcpp/glcpp-parse.y
index 2a8ea817a98..173e1a1586b 100644
--- a/src/compiler/glsl/glcpp/glcpp-parse.y
+++ b/src/compiler/glsl/glcpp/glcpp-parse.y
@@ -1187,6 +1187,9 @@ _token_list_equal_ignoring_space(token_list_t *a, token_list_t *b)
node_b = node_b->next;
}
+ if (node_a == NULL && node_b == NULL)
+ break;
+
if (node_b == NULL && node_a->token->type == SPACE) {
while (node_a && node_a->token->type == SPACE)
node_a = node_a->next;