summaryrefslogtreecommitdiff
path: root/src/compiler/glsl
diff options
context:
space:
mode:
authorHanno Böck <hanno@hboeck.de>2018-11-07 09:01:42 +0100
committerTapani Pälli <tapani.palli@intel.com>2018-11-12 07:42:58 +0200
commit8dc2085baf954e7d52159797fe3051a554df3f6d (patch)
tree9d45268ab534d59e59aa8d3446abc09650ca358c /src/compiler/glsl
parenta068958692cc662203f04e488356005533568a56 (diff)
downloadmesa-8dc2085baf954e7d52159797fe3051a554df3f6d.tar.gz
mesa-8dc2085baf954e7d52159797fe3051a554df3f6d.tar.bz2
mesa-8dc2085baf954e7d52159797fe3051a554df3f6d.zip
glsl/test: Fix use after free in test_optpass.
The variable state is free'd and afterwards state->error is used as the return value, resulting in a use after free bug detected by memory safety tools like address sanitizer. Signed-off-by: Hanno Böck <hanno@hboeck.de> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108636 Reviewed-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r--src/compiler/glsl/test_optpass.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler/glsl/test_optpass.cpp b/src/compiler/glsl/test_optpass.cpp
index 735129d91e9..638ffeb2fe4 100644
--- a/src/compiler/glsl/test_optpass.cpp
+++ b/src/compiler/glsl/test_optpass.cpp
@@ -166,6 +166,7 @@ int test_optpass(int argc, char **argv)
int loop = 0;
int shader_type = GL_VERTEX_SHADER;
int quiet = 0;
+ int error;
const struct option optpass_opts[] = {
{ "input-ir", no_argument, &input_format_ir, 1 },
@@ -264,9 +265,11 @@ int test_optpass(int argc, char **argv)
printf("--\n");
}
+ error = state->error;
+
ralloc_free(state);
ralloc_free(shader);
- return state->error;
+ return error;
}