diff options
-rw-r--r-- | libpcsxcore/cdrom.c | 4 | ||||
-rw-r--r-- | plugins/gpulib/gpu.c | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/libpcsxcore/cdrom.c b/libpcsxcore/cdrom.c index a65ca54..a417a52 100644 --- a/libpcsxcore/cdrom.c +++ b/libpcsxcore/cdrom.c @@ -1499,7 +1499,9 @@ int cdrFreeze(void *f, int Mode) { pTransfer = cdr.Transfer + tmp; // read right sub data - memcpy(tmpp, cdr.Prev, 3); + tmpp[0] = btoi(cdr.Prev[0]); + tmpp[1] = btoi(cdr.Prev[1]); + tmpp[2] = btoi(cdr.Prev[2]); cdr.Prev[0]++; ReadTrack(tmpp); diff --git a/plugins/gpulib/gpu.c b/plugins/gpulib/gpu.c index 17386b4..007da65 100644 --- a/plugins/gpulib/gpu.c +++ b/plugins/gpulib/gpu.c @@ -528,6 +528,12 @@ static noinline int do_cmd_buffer(uint32_t *data, int count) cmd = data[pos] >> 24; if (0xa0 <= cmd && cmd <= 0xdf) { + if (unlikely((pos+2) >= count)) { + // incomplete vram write/read cmd, can't consume yet + cmd = -1; + break; + } + // consume vram write/read cmd start_vram_transfer(data[pos + 1], data[pos + 2], (cmd & 0xe0) == 0xc0); pos += 3; |