svu: fix buffer overrun on ialu&fmac

CID 146904 (#1 of 1): Out-of-bounds write (OVERRUN)
10. overrun-local: Overrunning array VU->ialu of 8 16-byte elements at element index 8 (byte offset 128) using index i (which evaluates to 8).

CID 146903 (#1 of 1): Out-of-bounds write (OVERRUN)
10. overrun-local: Overrunning array VU->fmac of 8 32-byte elements at element index 8 (byte offset 256) using index i (which evaluates to 8).
This commit is contained in:
Gregory Hainaut 2015-09-25 21:04:58 +02:00
parent 037bd3109e
commit 070afe57af
1 changed files with 17 additions and 13 deletions

View File

@ -292,14 +292,16 @@ void _recvuFMACAdd(VURegs * VU, int reg, int xyzw) {
break;
}
if (i==8) Console.Error("*PCSX2*: error , out of fmacs");
if (i==8) {
Console.Error("*PCSX2*: error , out of fmacs");
// VUM_LOG("adding FMAC pipe[%d]; reg %d", i, reg);
VU->fmac[i].enable = 1;
VU->fmac[i].sCycle = vucycle;
VU->fmac[i].Cycle = 3;
VU->fmac[i].xyzw = xyzw;
VU->fmac[i].reg = reg;
} else {
VU->fmac[i].enable = 1;
VU->fmac[i].sCycle = vucycle;
VU->fmac[i].Cycle = 3;
VU->fmac[i].xyzw = xyzw;
VU->fmac[i].reg = reg;
}
}
void _recvuFDIVAdd(VURegs * VU, int cycles) {
@ -325,12 +327,14 @@ void _recvuIALUAdd(VURegs * VU, int reg, int cycles) {
break;
}
if (i==8) Console.Error("*PCSX2*: error , out of ialus");
VU->ialu[i].enable = 1;
VU->ialu[i].sCycle = vucycle;
VU->ialu[i].Cycle = cycles;
VU->ialu[i].reg = reg;
if (i==8) {
Console.Error("*PCSX2*: error , out of ialus");
} else {
VU->ialu[i].enable = 1;
VU->ialu[i].sCycle = vucycle;
VU->ialu[i].Cycle = cycles;
VU->ialu[i].reg = reg;
}
}
void _recvuTestIALUStalls(VURegs * VU, _VURegsNum *VUregsn) {