shithub: psxe

Download patch

ref: cb6938d54b06d08d5750b45ac70f25c2d9e213e0
parent: e8f7dd84b9420b8570a136f13cca865cdd684656
author: allkern <lisandroaalarcon@gmail.com>
date: Tue Sep 19 06:58:15 EDT 2023

Fix line segfault

--- a/psx/dev/cdrom.c
+++ b/psx/dev/cdrom.c
@@ -1307,6 +1307,9 @@
         return;
     }
 
+    if (!cdrom->disc)
+        return;
+
     memcpy(buf, cdrom->cdda_buf, size);
 
     // Convert seek to I
--- a/psx/dev/gpu.c
+++ b/psx/dev/gpu.c
@@ -454,7 +454,7 @@
     int y = y0;
 
     for (int x = x0; x < x1; x++) {
-        if ((x < 1024) && (y < 512))
+        if ((x < 1024) && (y < 512) && (x >= 0) && (y >= 0))
             gpu->vram[x + (y * 1024)] = color;
 
         if (d > 0) {
--