Module: Mesa
Branch: master
Commit: 71a36e0a2c0f301aa83989dc4ade700a9751493d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=71a36e0a2c0f301aa83989dc4ade700a9751493d

Author: Iago Toral Quiroga <[email protected]>
Date:   Tue Jan 20 17:07:13 2015 +0100

glsl: GLSL ES identifiers cannot exceed 1024 characters

v2 (Ian Romanick)
- Move the check to the lexer before rallocing a copy of the large string.

Fixes the following 2 dEQP tests:
dEQP-GLES3.functional.shaders.keywords.invalid_identifiers.max_length_vertex
dEQP-GLES3.functional.shaders.keywords.invalid_identifiers.max_length_fragment

Reviewed-by: Ian Romanick <[email protected]>

---

 src/glsl/glsl_lexer.ll |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/glsl/glsl_lexer.ll b/src/glsl/glsl_lexer.ll
index 57c46be..48ba463 100644
--- a/src/glsl/glsl_lexer.ll
+++ b/src/glsl/glsl_lexer.ll
@@ -544,7 +544,13 @@ subroutine KEYWORD(0, 300, 0, 0, SUBROUTINE);
 [_a-zA-Z][_a-zA-Z0-9]* {
                            struct _mesa_glsl_parse_state *state = yyextra;
                            void *ctx = state;  
-                           yylval->identifier = ralloc_strdup(ctx, yytext);
+                           if (state->es_shader && strlen(yytext) > 1024) {
+                              _mesa_glsl_error(yylloc, state,
+                                               "Identifier `%s' exceeds 1024 
characters",
+                                               yytext);
+                           } else {
+                             yylval->identifier = ralloc_strdup(ctx, yytext);
+                           }
                            return classify_identifier(state, yytext);
                        }
 

_______________________________________________
mesa-commit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to