From 02492bea5f4749f5359eb2b9216a67af0fc193ea Mon Sep 17 00:00:00 2001 From: Jesse Schwartzentruber Date: Thu, 11 Mar 2021 11:08:36 -0500 Subject: [PATCH] glcpp: Fix undefined behaviour in glcpp Specifically, fix this error (which is covered in existing tests): ../src/compiler/glsl/glcpp/pp.c:198:28: runtime error: applying non-zero offset 1 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/compiler/glsl/glcpp/pp.c:198:28 in Reviewed-by: Erik Faye-Lund Reviewed-by: Matt Turner Part-of: --- src/compiler/glsl/glcpp/pp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/glsl/glcpp/pp.c b/src/compiler/glsl/glcpp/pp.c index aadf899..db53e7d 100644 --- a/src/compiler/glsl/glcpp/pp.c +++ b/src/compiler/glsl/glcpp/pp.c @@ -195,11 +195,11 @@ remove_line_continuations(glcpp_parser_t *ctx, const char *shader) } } - search_start = backslash + 1; - if (backslash == NULL) break; + search_start = backslash + 1; + /* At each line continuation, (backslash followed by a * newline), copy all preceding text to the output, then * advance the shader pointer to the character after the -- 2.7.4