summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/shader_query.cpp
diff options
context:
space:
mode:
authorSamuel Iglesias Gonsálvez <[email protected]>2020-01-08 19:12:53 +0100
committerSamuel Iglesias Gonsálvez <[email protected]>2020-01-10 08:40:00 +0100
commit39c1892dd82e6a52cb6d7ea100dfee877bd4aa2c (patch)
tree418b9da3282ea0fb62666985d34d8ccb622c6eca /src/mesa/main/shader_query.cpp
parentf2f12776248874b2a689cbba8faeb6e4e2144354 (diff)
main: fix coverity error in _mesa_program_resource_find_name()
We did not take into account if name is NULL, so we could dereference a NULL pointer in strncmp() call. Signed-off-by: Samuel Iglesias Gonsálvez <[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.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 1a50abc31d0..9a16a28d393 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -581,8 +581,11 @@ _mesa_program_resource_find_name(struct gl_shader_program *shProg,
{
struct gl_program_resource *res = NULL;
+ if (name == NULL)
+ return NULL;
+
/* If we have a name, try the ProgramResourceHash first. */
- if (name && shProg->data->ProgramResourceHash)
+ if (shProg->data->ProgramResourceHash)
res = search_resource_hash(shProg, programInterface, name, array_index);
if (res)