r1100 - trunk/code/qcommon
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Mon Jun 25 05:45:18 EDT 2007
Author: ludwig
Date: 2007-06-25 05:45:18 -0400 (Mon, 25 Jun 2007)
New Revision: 1100
Modified:
trunk/code/qcommon/vm_interpreted.c
Log:
check program counter on OP_CALL and OP_LEAVE
Modified: trunk/code/qcommon/vm_interpreted.c
===================================================================
--- trunk/code/qcommon/vm_interpreted.c 2007-06-13 20:41:06 UTC (rev 1099)
+++ trunk/code/qcommon/vm_interpreted.c 2007-06-25 09:45:18 UTC (rev 1100)
@@ -394,9 +394,8 @@
r0 = ((int *)opStack)[0];
r1 = ((int *)opStack)[-1];
nextInstruction2:
- opcode = codeImage[ programCounter++ ];
#ifdef DEBUG_VM
- if ( (unsigned)programCounter > vm->codeLength ) {
+ if ( (unsigned)programCounter >= vm->codeLength ) {
Com_Error( ERR_DROP, "VM pc out of range" );
}
@@ -420,6 +419,7 @@
}
profileSymbol->profileCount++;
#endif
+ opcode = codeImage[ programCounter++ ];
switch ( opcode ) {
#ifdef DEBUG_VM
@@ -564,6 +564,8 @@
Com_Printf( "%s<--- %s\n", DEBUGSTR, VM_ValueToSymbol( vm, programCounter ) );
}
#endif
+ } else if ( (unsigned)programCounter >= vm->codeLength ) {
+ Com_Error( ERR_DROP, "VM program counter out of range in OP_CALL" );
} else {
programCounter = vm->instructionPointers[ programCounter ];
}
@@ -619,6 +621,8 @@
// check for leaving the VM
if ( programCounter == -1 ) {
goto done;
+ } else if ( (unsigned)programCounter >= vm->codeLength ) {
+ Com_Error( ERR_DROP, "VM program counter out of range in OP_LEAVE" );
}
goto nextInstruction;
More information about the quake3-commits
mailing list