[Mesa-dev] [PATCH] st/mesa: fix potential null deref if no shader is passed in
Ilia Mirkin
imirkin at alum.mit.edu
Wed Feb 3 18:53:58 UTC 2016
Spotted by Coverity
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
src/mesa/state_tracker/st_atom_storagebuf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/mesa/state_tracker/st_atom_storagebuf.c b/src/mesa/state_tracker/st_atom_storagebuf.c
index a581818..f165cc3 100644
--- a/src/mesa/state_tracker/st_atom_storagebuf.c
+++ b/src/mesa/state_tracker/st_atom_storagebuf.c
@@ -46,11 +46,13 @@ st_bind_ssbos(struct st_context *st, struct gl_shader *shader,
{
unsigned i;
struct pipe_shader_buffer buffers[MAX_SHADER_STORAGE_BUFFERS];
- struct gl_program_constants *c = &st->ctx->Const.Program[shader->Stage];
+ struct gl_program_constants *c;
if (!shader || !st->pipe->set_shader_buffers)
return;
+ c = &st->ctx->Const.Program[shader->Stage];
+
for (i = 0; i < shader->NumShaderStorageBlocks; i++) {
struct gl_shader_storage_buffer_binding *binding;
struct st_buffer_object *st_obj;
--
2.4.10
More information about the mesa-dev
mailing list