summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2009-11-20 21:42:06 +0100
committerEric Anholt <[email protected]>2009-11-20 21:46:48 +0100
commitc4e8918cd248189d43cdc8df9f9f0450040261c5 (patch)
tree1c4a1894408e6a18ef90717a11be6134d8c19ff6 /src/mesa
parent48deddaa6f81e58f0ad6ab1c6cbd31c0184a0a3b (diff)
mesa: Fix NULL deref in optimizer when NumInstructions == 0.
Bug #24984.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/shader/prog_optimize.c2
1 files changed, 1 insertions, 1 deletions
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 ||