mesa/src
Kenneth Graunke c87cb98bb4 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 <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Paul Berry <stereotype441@gmail.com>
2011-12-13 22:54:16 -08:00
..
egl egl_dri2: Fix some valgrind reported leaks 2011-12-13 15:32:43 +01:00
gallium r300g: take advantage of KEEP_TILING_FLAGS flush flag 2011-12-13 21:34:18 +01:00
gbm gbm/dri: avoid crash in dri_screen_create 2011-08-04 14:09:34 +02:00
getopt getopt: Make code more portable. 2011-01-12 16:54:21 +00:00
glsl glsl: Fix crashes caused by Bison error messages involving "'%'". 2011-12-13 22:54:16 -08:00
glu glu: Fix deprecated conversion from string constant to ‘char*’ warning. 2011-11-09 10:24:37 +00:00
glx Regenerate files from previous commits 2011-12-13 16:07:17 -08:00
mapi Regenerate files from previous commits 2011-12-13 16:07:17 -08:00
mesa Regenerate files from previous commits 2011-12-13 16:07:17 -08:00
Makefile
SConscript scons: Unbreak mingw build. 2011-09-20 20:50:48 +01:00