summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shader_query.cpp
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2015-08-02 11:40:26 +1000
committerTimothy Arceri <[email protected]>2015-08-03 21:28:12 +1000
commitcf5667108b2cdd6f37e1a561c18fb5c757258f06 (patch)
tree0e34b29143b2f52aa9e8fbe68abe84a0e87cb5c5 /src/mesa/main/shader_query.cpp
parent704e764f06e8e6ec75484e28271e502bbc4cf06a (diff)
mesa: fix type for array indexing validation
parse_program_resource_name returns -1 when the index is invalid this needs to be tested before assigning the value to the unsigned array_index. In link_varyings.cpp (the other place parse_program_resource_name is used) after the -1 check is done the value is just assigned to an unsigned variable so it seems long is just used so we can return the -1 rather than actually expecting index values to be ridiculously large. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
Diffstat (limited to 'src/mesa/main/shader_query.cpp')
-rw-r--r--src/mesa/main/shader_query.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index b49fd38d64d..a85e4c42ae3 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -506,7 +506,7 @@ _mesa_program_resource_array_size(struct gl_program_resource *res)
static bool
valid_array_index(const GLchar *name, unsigned *array_index)
{
- unsigned idx = 0;
+ long idx = 0;
const GLchar *out_base_name_end;
idx = parse_program_resource_name(name, &out_base_name_end);