Module: Mesa Branch: master Commit: 86677f101641c75d52577e3cd9e76441b1228b21 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=86677f101641c75d52577e3cd9e76441b1228b21
Author: Timothy Arceri <[email protected]> Date: Sun Jan 17 16:09:08 2016 +1100 mesa: fix segfault in glUniformSubroutinesuiv() From Section 7.9 (SUBROUTINE UNIFORM VARIABLES) of the OpenGL 4.5 Core spec: "The command void UniformSubroutinesuiv(enum shadertype, sizei count, const uint *indices); will load all active subroutine uniforms for shader stage shadertype with subroutine indices from indices, storing indices[i] into the uniform at location i. The indices for any locations between zero and the value of ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS minus one which are not used will be ignored." V2: simplify NULL check suggested by Jason. Acked-by: Jason Ekstrand <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Cc: "11.0 11.1" [email protected] https://bugs.freedesktop.org/show_bug.cgi?id=93731 --- src/mesa/main/shaderapi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index cdc85f3..126786c 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -2530,6 +2530,11 @@ _mesa_UniformSubroutinesuiv(GLenum shadertype, GLsizei count, i = 0; do { struct gl_uniform_storage *uni = sh->SubroutineUniformRemapTable[i]; + if (uni == NULL) { + i++; + continue; + } + int uni_count = uni->array_elements ? uni->array_elements : 1; int j, k; @@ -2557,6 +2562,11 @@ _mesa_UniformSubroutinesuiv(GLenum shadertype, GLsizei count, i = 0; do { struct gl_uniform_storage *uni = sh->SubroutineUniformRemapTable[i]; + if (uni == NULL) { + i++; + continue; + } + int uni_count = uni->array_elements ? uni->array_elements : 1; memcpy(&uni->storage[0], &indices[i], _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
