psxbios: Add checks for memchr.
authorgameblabla <gameblabla@openmailbox.org>
Sun, 21 Jul 2019 05:43:56 +0000 (07:43 +0200)
committergameblabla <gameblabla@openmailbox.org>
Sun, 21 Jul 2019 05:43:56 +0000 (07:43 +0200)
libpcsxcore/psxbios.c

index 7b2c05f..3247402 100644 (file)
@@ -924,6 +924,12 @@ void psxBios_memcmp() { // 0x2d
 
 void psxBios_memchr() { // 0x2e
        char *p = (char *)Ra0;
+       
+       if (a0 == 0 || a2 > 0x7FFFFFFF)
+       {
+               pc0 = ra;
+               return;
+       }
 
        while ((s32)a2-- > 0) {
                if (*p++ != (s8)a1) continue;