From: Justin Weiss Date: Tue, 29 Sep 2020 01:12:17 +0000 (-0700) Subject: Correctly signal errors for out-of-bounds async CD reads X-Git-Tag: r24l~623^2 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00e692901132f23fcb1c36f660a6e1f0c889c0f3;p=pcsx_rearmed.git Correctly signal errors for out-of-bounds async CD reads --- diff --git a/libpcsxcore/cdriso.c b/libpcsxcore/cdriso.c index c8eacb87..6c6d8356 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(§orbuffer_lock); + sectorbuffer[index].ret = -1; + sectorbuffer[index].sector = ra_sector; + pthread_cond_signal(§orbuffer_cond); + pthread_mutex_unlock(§orbuffer_lock); } if (ra_count) { - - index = ra_sector % SECTOR_BUFFER_SIZE; pthread_mutex_lock(§orbuffer_lock); if (sectorbuffer[index].sector != ra_sector) { pthread_mutex_unlock(§orbuffer_lock);