glsl: check for leading zeros in array index validation
authorTimothy Arceri <t_arceri@yahoo.com.au>
Thu, 2 Jul 2015 22:45:30 +0000 (08:45 +1000)
committerTimothy Arceri <t_arceri@yahoo.com.au>
Wed, 22 Jul 2015 02:58:33 +0000 (12:58 +1000)
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
src/glsl/linker.cpp

index 28ad2f38e0edcd0531ba0c024fb8174e5242fba7..58dd9fbfdae743e36e8eb776bbd427623330df5d 100644 (file)
@@ -462,6 +462,10 @@ parse_program_resource_name(const GLchar *name,
    if (array_index < 0)
       return -1;
 
+   /* Check for leading zero */
+   if (name[i] == '0' && name[i+1] != ']')
+      return -1;
+
    *out_base_name_end = name + (i - 1);
    return array_index;
 }