1
0
Fork 0

Stay within array limits

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3712
This commit is contained in:
Peter Veenstra 2011-05-15 20:25:28 +00:00
parent 7f27714557
commit 8e7cbdda70
2 changed files with 7 additions and 3 deletions

View file

@ -1725,7 +1725,10 @@ Bit32u DEBUG_CheckKeys(void) {
}
if (ret<0) return ret;
if (ret>0) {
ret=(*CallBack_Handlers[ret])();
if (GCC_UNLIKELY(ret >= CB_MAX))
ret = 0;
else
ret = (*CallBack_Handlers[ret])();
if (ret) {
exitLoop=true;
CPU_Cycles=CPU_CycleLeft=0;

View file

@ -128,10 +128,11 @@ static Bitu Normal_Loop(void) {
Bits ret;
while (1) {
if (PIC_RunQueue()) {
ret=(*cpudecoder)();
ret = (*cpudecoder)();
if (GCC_UNLIKELY(ret<0)) return 1;
if (ret>0) {
Bitu blah=(*CallBack_Handlers[ret])();
if (GCC_UNLIKELY(ret >= CB_MAX)) return 0;
Bitu blah = (*CallBack_Handlers[ret])();
if (GCC_UNLIKELY(blah)) return blah;
}
#if C_DEBUG