[Mesa-dev] [PATCH 08/11] glsl: GLSL ES identifiers cannot exceed 1024 characters

Ian Romanick idr at freedesktop.org
Mon Jan 19 19:25:59 PST 2015


On 01/19/2015 04:41 AM, Erik Faye-Lund wrote:
> On Mon, Jan 19, 2015 at 12:32 PM, Eduardo Lima Mitev <elima at igalia.com> wrote:
>> From: Iago Toral Quiroga <itoral at igalia.com>
>>
>> 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
>> ---
>>  src/glsl/glsl_parser.yy | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
>> index 7fb8c38..165419c 100644
>> --- a/src/glsl/glsl_parser.yy
>> +++ b/src/glsl/glsl_parser.yy
>> @@ -362,6 +362,13 @@ any_identifier:
>>     IDENTIFIER
>>     | TYPE_IDENTIFIER
>>     | NEW_IDENTIFIER
>> +   {
>> +      if (state->es_shader && strlen($1) > 1024) {
>> +         _mesa_glsl_error(& @1, state,
>> +                          "Identifier `%s' exceeds "
>> +                          "1024 characters", $1);
>> +      }
>> +   }
> 
> The limit of 1024 characters for identifiers is only specified for
> OpenGL ES Shading Language versions 3.00 and up, not for version 1.00
> as OpenGL ES 2.0 uses. Perhaps a spec bug?

If I had to wager a guess... I'd guess that the limitation was added
because shipping ES2 implementations already had such a limit (or just
had bugs with very large identifiers).  Assuming that's the case, this
check should be safe universally.

However, checking here defeats the purpose of having such a limitation.
 It seems like we should do this in the lexer... before rallocing a copy
of the large string.

> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list