From: Eric Anholt Date: Fri, 20 Nov 2009 20:42:06 +0000 (+0100) Subject: mesa: Fix NULL deref in optimizer when NumInstructions == 0. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c4e8918cd248189d43cdc8df9f9f0450040261c5;p=mesa.git mesa: Fix NULL deref in optimizer when NumInstructions == 0. Bug #24984. --- diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c index 3d28d885a44..4fe351251e8 100644 --- a/src/mesa/shader/prog_optimize.c +++ b/src/mesa/shader/prog_optimize.c @@ -443,7 +443,7 @@ _mesa_remove_extra_move_use(struct gl_program *prog) * FOO tmpY, arg0, arg1; */ - for (i = 0; i < prog->NumInstructions - 1; i++) { + for (i = 0; i + 1 < prog->NumInstructions; i++) { const struct prog_instruction *mov = prog->Instructions + i; if (mov->Opcode != OPCODE_MOV ||