pcsx2: avoid couple of out-of-bounds access

This commit is contained in:
Gregory Hainaut 2015-09-10 14:20:51 +02:00
parent c687c73edd
commit f4f08b9c99
4 changed files with 19 additions and 15 deletions

View File

@ -28,7 +28,8 @@ namespace R3000A
"r0", "at", "v0", "v1", "a0", "a1","a2", "a3",
"t0", "t1", "t2", "t3", "t4", "t5","t6", "t7",
"s0", "s1", "s2", "s3", "s4", "s5","s6", "s7",
"t8", "t9", "k0", "k1", "gp", "sp","fp", "ra"};
"t8", "t9", "k0", "k1", "gp", "sp","fp", "ra"
"HI", "LO" };
const char * const disRNameCP0[] = {
"Index" , "Random" , "EntryLo0", "EntryLo1", "Context" , "PageMask" , "Wired" , "*Check me*",

View File

@ -156,7 +156,7 @@ void sio2_serialIn(u8 value){
if (sio2.cmdlength) sio2.cmdlength--;
sioWrite8(value);
if (sio2.packet.sendSize > BUFSIZE) {//asadr
if (sio2.packet.sendSize >= BUFSIZE) {//asadr
Console.Warning("*PCSX2*: sendSize >= %d", BUFSIZE);
} else {
sio2.buf[sio2.packet.sendSize] = sioRead8();
@ -183,7 +183,7 @@ void sio2_fifoIn(u8 value){
if (sio2.cmdlength) sio2.cmdlength--;
SIODMAWrite(value);
if (sio2.packet.sendSize > BUFSIZE) {//asadr
if (sio2.packet.sendSize >= BUFSIZE) {//asadr
Console.WriteLn("*PCSX2*: sendSize >= %d", BUFSIZE);
} else {
sio2.buf[sio2.packet.sendSize] = sioRead8();

View File

@ -298,7 +298,8 @@ protected:
volatile u32 m_mcdOpen;
public: // hack until we unsuck plugins...
ScopedPtr<PluginStatus_t> m_info[PluginId_Count];
// +1 to avoid out-of-bounds due to PluginId_Mcd which is above PluginId_Count
ScopedPtr<PluginStatus_t> m_info[PluginId_Count + 1];
public:
SysCorePlugins();

View File

@ -176,9 +176,8 @@ static __ri void __fastcall _vuFMACAdd(VURegs * VU, int reg, int xyzw) {
if (VU->fmac[i].enable == 1) continue;
break;
}
//if (i==8) Console.Error("*PCSX2*: error , out of fmacs %d", VU->cycle);
if (i < 8) {
VUM_LOG("adding FMAC pipe[%d]; xyzw=%x", i, xyzw);
VU->fmac[i].enable = 1;
@ -189,6 +188,9 @@ static __ri void __fastcall _vuFMACAdd(VURegs * VU, int reg, int xyzw) {
VU->fmac[i].macflag = VU->macflag;
VU->fmac[i].statusflag = VU->statusflag;
VU->fmac[i].clipflag = VU->clipflag;
} else {
//Console.Error("*PCSX2*: error , out of fmacs %d", VU->cycle);
}
}
static __ri void __fastcall _vuFDIVAdd(VURegs * VU, int cycles) {