aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgameblabla2019-07-18 02:15:27 +0200
committergameblabla2019-07-18 02:15:27 +0200
commit01724d23d3e65e6ca12f3800d79c7de6ec241ea2 (patch)
tree83d9d219094eb6029d8d9fa61bc25f2dbe196961
parent0148ffb739a05e87ed9eaaf623c754d3d50ee2ab (diff)
downloadpcsx_rearmed-01724d23d3e65e6ca12f3800d79c7de6ec241ea2.tar.gz
pcsx_rearmed-01724d23d3e65e6ca12f3800d79c7de6ec241ea2.tar.bz2
pcsx_rearmed-01724d23d3e65e6ca12f3800d79c7de6ec241ea2.zip
psxbios: Add checks for bzero.
Only return 0 if size is invalid. (0 or 0x7FFFFFFF), return dst if not.
-rw-r--r--libpcsxcore/psxbios.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c
index 4019234..c362a75 100644
--- a/libpcsxcore/psxbios.c
+++ b/libpcsxcore/psxbios.c
@@ -752,7 +752,21 @@ void psxBios_bcopy() { // 0x27
void psxBios_bzero() { // 0x28
char *p = (char *)Ra0;
+ v0 = a0;
+ /* Same as memset here (See memset below) */
+ if (a1 > 0x7FFFFFFF || a1 == 0)
+ {
+ v0 = 0;
+ pc0 = ra;
+ return;
+ }
+ else if (a0 == 0)
+ {
+ pc0 = ra;
+ return;
+ }
while ((s32)a1-- > 0) *p++ = '\0';
+ a1 = 0;
pc0 = ra;
}