nv40: Avoid a nasty array overflow leading to a corrupt memory pointer.
authorMaarten Maathuis <madman2003@gmail.com>
Wed, 13 Feb 2008 21:57:09 +0000 (22:57 +0100)
committerMaarten Maathuis <madman2003@gmail.com>
Wed, 13 Feb 2008 21:57:09 +0000 (22:57 +0100)
src/mesa/pipe/nv40/nv40_fragprog.c

index 714634396d22267370f03165b9be4e6e2e554584..14897f97982a8ee163b46e13dab1dc1df3262065 100644 (file)
@@ -716,7 +716,7 @@ nv40_fragprog_translate(struct nv40_context *nv40,
                        assert(imm->Immediate.DataType == TGSI_IMM_FLOAT32);
                        assert(fpc->nr_imm < MAX_IMM);
 
-                       for (i = 0; i < imm->Immediate.Size; i++)
+                       for (i = 0; i < (imm->Immediate.Size - 1); i++)
                                vals[i] = imm->u.ImmediateFloat32[i].Float;
                        fpc->imm[fpc->nr_imm++] = constant(fpc, -1, vals);
                }