Mesa (10.1): mesa/main: Prevent sefgault on glGetIntegerv( GL_ATOMIC_COUNTER_BUFFER_BINDING).
Carl Worth
cworth at kemper.freedesktop.org
Mon Jun 23 23:30:00 UTC 2014
Module: Mesa
Branch: 10.1
Commit: f6bf295924cdbd567db1554622a429950d48e452
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6bf295924cdbd567db1554622a429950d48e452
Author: José Fonseca <jfonseca at vmware.com>
Date: Fri Jun 6 23:59:18 2014 +0100
mesa/main: Prevent sefgault on glGetIntegerv(GL_ATOMIC_COUNTER_BUFFER_BINDING).
A recent ApiTrace change, that tries to dump more buffer state
causes Mesa from my distro (10.1.4) to segfaults here.
I haven't actually confirm this fixes it (I can't repro on master),
but it seems a good idea to be defensive here anyway.
Cc: "10.1 10.2" <mesa-stable at lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
(cherry picked from commit eb58aa9cf015e79a0fcf2e088676e6aa1d5dabce)
---
src/mesa/main/get.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 8397b46..7b54a21 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -982,7 +982,11 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
break;
/* GL_ARB_shader_atomic_counters */
case GL_ATOMIC_COUNTER_BUFFER_BINDING:
- v->value_int = ctx->AtomicBuffer->Name;
+ if (ctx->AtomicBuffer) {
+ v->value_int = ctx->AtomicBuffer->Name;
+ } else {
+ v->value_int = 0;
+ }
break;
/* GL_ARB_draw_indirect */
case GL_DRAW_INDIRECT_BUFFER_BINDING:
More information about the mesa-commit
mailing list