Mesa (master): r300/compiler: Assert that array index is not negative.

Vinson Lee vlee at kemper.freedesktop.org
Fri Feb 26 08:18:14 UTC 2010


Module: Mesa
Branch: master
Commit: e5c691f445e1c02e6e2f75b817b13d7024f7a3a6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e5c691f445e1c02e6e2f75b817b13d7024f7a3a6

Author: Vinson Lee <vlee at vmware.com>
Date:   Fri Feb 26 00:17:03 2010 -0800

r300/compiler: Assert that array index is not negative.

---

 .../drivers/dri/r300/compiler/r500_fragprog_emit.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
index 829f028..710cae7 100644
--- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
+++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
@@ -469,6 +469,8 @@ void r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compi
 	if (compiler->Base.Error)
 		return;
 
+	assert(code->inst_end >= 0);
+
 	if ((code->inst[code->inst_end].inst0 & R500_INST_TYPE_MASK) != R500_INST_TYPE_OUT) {
 		/* This may happen when dead-code elimination is disabled or
 		 * when most of the fragment program logic is leading to a KIL */




More information about the mesa-commit mailing list