diff options
author | Kenneth Graunke <[email protected]> | 2011-12-08 01:35:48 -0800 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2011-12-13 22:54:16 -0800 |
commit | c87cb98bb4e893e04831bf68231f5ed42e0b5b6f (patch) | |
tree | 7d7af40479e55c134c16f3e0102be7f59221e109 /configs | |
parent | 7e9cb2ac6dd9af5ea1597df8a2015b620aad57a1 (diff) |
glsl: Fix crashes caused by Bison error messages involving "'%'".
Invalid shaders containing the character % at an unexpected location
would cause Bison to call yyerror with a message of:
syntax error, unexpected '%'
Bison expects yyerror() to take a string, while _mesa_glsl_error() is a
printf-style function. This hit the classic printf string escape issue:
_mesa_glsl_error(loc, state, "unexpected '%'"); // invalid!
_mesa_glsl_error(loc, state, "%s", "unexpected '%'"); // correct.
This caused assertion failures after ralloc_asprintf_append called
vsnprintf to determine the length of the text that would be printed:
vsnprintf would see the invalid format and return -1, an invalid length.
The solution is to define a proper yyerror() wrapper function that calls
_mesa_glsl_error with the "%s". Since we compile with -p "_mesa_glsl",
yyerror is defined as:
#define yyerror _mesa_glsl_error
So we have to #undef yyerror in order to be able to declare it.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43564
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Acked-by: Paul Berry <[email protected]>
Diffstat (limited to 'configs')
0 files changed, 0 insertions, 0 deletions