notaz.gp2x.de
/
pcsx_rearmed.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
01724d2
)
psxbios: Add checks to memcpy.
author
gameblabla
<gameblabla@openmailbox.org>
Thu, 18 Jul 2019 00:16:41 +0000
(
02:16
+0200)
committer
gameblabla
<gameblabla@openmailbox.org>
Thu, 18 Jul 2019 00:16:41 +0000
(
02:16
+0200)
Always returns dst
libpcsxcore/psxbios.c
patch
|
blob
|
blame
|
history
diff --git
a/libpcsxcore/psxbios.c
b/libpcsxcore/psxbios.c
index
c362a75
..
b327632
100644
(file)
--- a/
libpcsxcore/psxbios.c
+++ b/
libpcsxcore/psxbios.c
@@
-788,9
+788,19
@@
void psxBios_bcmp() { // 0x29
void psxBios_memcpy() { // 0x2a
char *p1 = (char *)Ra0, *p2 = (char *)Ra1;
- while ((s32)a2-- > 0) *p1++ = *p2++;
-
- v0 = a0; pc0 = ra;
+ s32 n=0;
+ v0 = a0;
+ if (a0 == 0 || a2 > 0x7FFFFFFF)
+ {
+ pc0 = ra;
+ return;
+ }
+ while ((s32)a2-- > 0) {
+ n++;
+ *p1++ = *p2++;
+ }
+ a2 = 0;
+ pc0 = ra;
}
void psxBios_memset() { // 0x2b