From 0f598f20d1c618933ffd1a02207912915fcd454e Mon Sep 17 00:00:00 2001 From: gameblabla Date: Sun, 21 Jul 2019 07:43:56 +0200 Subject: [PATCH] psxbios: Add checks for memchr. --- libpcsxcore/psxbios.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- 2.39.5