From c514572f0914a4c4df6d763eea0fc9901f9b7c80 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Thu, 11 Dec 2014 19:51:38 +0000 Subject: Fix corner case in preprocessor of QOpenGLShaderProgram The preprocessor used in QOpenGLShaderProgram to help with determining where it should add the #line and other #define directives is broken when parsing the standard Qt Project copyright header. In a multiline comment if the preprocessor encounters repeated '*' characters when in a multiline comment, it toggles the state between MultiLineComment and CommentEnding. This is wrong as every asterisk is potentially the one before the closing '/' of a multiline comment. This change fixes this by only going back to the MultiLineComment when in the CommentEnding state if the character is not another '*'. Task-number: QTBUG-43240 Change-Id: I114e933026ba5de1c23f3e0399613def59f44961 Reviewed-by: Paul Lemire --- src/gui/opengl/qopenglshaderprogram.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gui/opengl/qopenglshaderprogram.cpp') diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp index 7d165aed48..2d99833fdf 100644 --- a/src/gui/opengl/qopenglshaderprogram.cpp +++ b/src/gui/opengl/qopenglshaderprogram.cpp @@ -471,7 +471,8 @@ static QVersionDirectivePosition findVersionDirectivePosition(const char *source } else { if (*c == QLatin1Char('#')) *c = QLatin1Char('_'); - state = MultiLineComment; + if (*c != QLatin1Char('*')) + state = MultiLineComment; } break; } -- cgit v1.2.3