guard against out-of-bounds jump table targets

This commit is contained in:
/dev/humancontroller 2014-07-21 17:43:53 +02:00 committed by Zack Middleton
parent 3c52f2dccc
commit 7b866ae96d

View file

@ -1087,8 +1087,9 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
// ensure that the optimisation pass knows about all the jump
// table targets
pc = -1; // a bogus value to be printed in out-of-bounds error messages
for( i = 0; i < vm->numJumpTableTargets; i++ ) {
jused[ *(int *)(vm->jumpTableTargets + ( i * sizeof( int ) ) ) ] = 1;
JUSED( *(int *)(vm->jumpTableTargets + ( i * sizeof( int ) ) ) );
}
// Start buffer with x86-VM specific procedures