Commit 9a9c0484 by Corentin Wallez Committed by Commit Bot

Lexer: Error out on invalid field start.

When parsing something like x.} the following would happen: - Parsing "." the lexer would move to the FIELDS start condition - Parsing } the lexer wouldn't find any <FIELDS> rule matching - The parser would fall back to <*>. that was asserted unreachable. The fix is to add a <FIELDS>. rule to catch bad field starts BUG=angleproject:1352 Change-Id: I262d2b9ef5f7346c19ae5e19a173e24f40f2f600 Reviewed-on: https://chromium-review.googlesource.com/338222Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
parent 50fcf744
......@@ -390,6 +390,11 @@ O [0-7]
return FIELD_SELECTION;
}
<FIELDS>[ \t\v\f\r] {}
<FIELDS>. {
yyextra->error(*yylloc, "Illegal character at fieldname start", yytext, "");
yyextra->recover();
return 0;
}
[ \t\v\n\f\r] { }
<*><<EOF>> { yyterminate(); }
......
......@@ -1058,6 +1058,19 @@ TEST_P(GLSLTest, NegativeShaderLength)
EXPECT_NE(compileResult, 0);
}
// Check that having an invalid char after the "." doesn't cause an assert.
TEST_P(GLSLTest, InvalidFieldFirstChar)
{
GLuint shader = glCreateShader(GL_VERTEX_SHADER);
const char *source = "void main() {vec4 x; x.}";
glShaderSource(shader, 1, &source, 0);
glCompileShader(shader);
GLint compileResult;
glGetShaderiv(shader, GL_COMPILE_STATUS, &compileResult);
EXPECT_EQ(0, compileResult);
}
// Verify that a length array with mixed positive and negative values compiles.
TEST_P(GLSLTest, MixedShaderLengths)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment