aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAutechre2020-10-11 00:29:50 +0200
committerGitHub2020-10-11 00:29:50 +0200
commit6a4504d66a1451e4c2c3d40dcd7be99cc8b9edb6 (patch)
tree1efc97f36d6fb37c8d809cf22005c73a3a3a4dbd
parentdb0d70df74dacac69856d38fe1b38c3c3d1c05e2 (diff)
parent00e692901132f23fcb1c36f660a6e1f0c889c0f3 (diff)
downloadpcsx_rearmed-6a4504d66a1451e4c2c3d40dcd7be99cc8b9edb6.tar.gz
pcsx_rearmed-6a4504d66a1451e4c2c3d40dcd7be99cc8b9edb6.tar.bz2
pcsx_rearmed-6a4504d66a1451e4c2c3d40dcd7be99cc8b9edb6.zip
Merge pull request #454 from justinweiss/handle-oob-cd-reads
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);