From: gameblabla Date: Sun, 21 Jul 2019 05:43:56 +0000 (+0200) Subject: psxbios: Add checks for memchr. X-Git-Tag: r23~156^2~4 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0f598f20d1c618933ffd1a02207912915fcd454e;p=pcsx_rearmed.git psxbios: Add checks for memchr. --- diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index 7b2c05fc..3247402d 100644 --- a/libpcsxcore/psxbios.c +++ b/libpcsxcore/psxbios.c @@ -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;