From c4e8918cd248189d43cdc8df9f9f0450040261c5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 20 Nov 2009 21:42:06 +0100 Subject: [PATCH] mesa: Fix NULL deref in optimizer when NumInstructions == 0. Bug #24984. --- src/mesa/shader/prog_optimize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 || -- 2.30.2