From: Paul Berry Date: Tue, 17 Dec 2013 18:11:27 +0000 (-0800) Subject: mesa: Add an assertion to _mesa_program_index_to_target(). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7e0b4b5e9b719de9f01e808fc18138b67be4178a;p=mesa.git mesa: Add an assertion to _mesa_program_index_to_target(). Only a Mesa bug could cause this function to be called with an out-of-range index, so raise an assertion if that ever happens. Reviewed-by: Brian Paul --- diff --git a/src/mesa/program/program.h b/src/mesa/program/program.h index 135271caf9a..baff473764d 100644 --- a/src/mesa/program/program.h +++ b/src/mesa/program/program.h @@ -216,9 +216,10 @@ _mesa_program_index_to_target(GLuint i) GL_FRAGMENT_PROGRAM_ARB }; STATIC_ASSERT(Elements(enums) == MESA_SHADER_TYPES); - if(i >= MESA_SHADER_TYPES) + if(i >= MESA_SHADER_TYPES) { + assert(!"Unexpected program index"); return 0; - else + } else return enums[i]; }