aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Weiss2020-09-28 18:12:17 -0700
committerJustin Weiss2020-10-10 15:06:19 -0700
commit00e692901132f23fcb1c36f660a6e1f0c889c0f3 (patch)
tree1efc97f36d6fb37c8d809cf22005c73a3a3a4dbd
parentdb0d70df74dacac69856d38fe1b38c3c3d1c05e2 (diff)
downloadpcsx_rearmed-00e692901132f23fcb1c36f660a6e1f0c889c0f3.tar.gz
pcsx_rearmed-00e692901132f23fcb1c36f660a6e1f0c889c0f3.tar.bz2
pcsx_rearmed-00e692901132f23fcb1c36f660a6e1f0c889c0f3.zip
Correctly signal errors for out-of-bounds async CD reads
-rw-r--r--libpcsxcore/cdriso.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c
index c8eacb8..6c6d835 100644
--- a/libpcsxcore/cdriso.c
+++ b/libpcsxcore/cdriso.c
@@ -1260,14 +1260,19 @@ static void *readThreadMain(void *param) {
last_read_sector = requested_sector_end;
}
+ index = ra_sector % SECTOR_BUFFER_SIZE;
+
// check for end of CD
if (ra_count && ra_sector >= max_sector) {
ra_count = 0;
+ pthread_mutex_lock(&sectorbuffer_lock);
+ sectorbuffer[index].ret = -1;
+ sectorbuffer[index].sector = ra_sector;
+ pthread_cond_signal(&sectorbuffer_cond);
+ pthread_mutex_unlock(&sectorbuffer_lock);
}
if (ra_count) {
-
- index = ra_sector % SECTOR_BUFFER_SIZE;
pthread_mutex_lock(&sectorbuffer_lock);
if (sectorbuffer[index].sector != ra_sector) {
pthread_mutex_unlock(&sectorbuffer_lock);