From 7e48f75a18654a55e5b001665eed8c4f52e9e162 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 21 Sep 2024 20:21:48 +0300 Subject: [PATCH] Remove last track being larger than total tracks check. It is allowed by SCSI spec. --- blkdev.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/blkdev.cpp b/blkdev.cpp index 19608d7d..92a60a80 100644 --- a/blkdev.cpp +++ b/blkdev.cpp @@ -1982,11 +1982,10 @@ int scsi_cd_emulate (int unitnum, uae_u8 *cmdbuf, int scsi_cmd_len, goto readerr; struct cd_toc_head *toc = &ttoc; if (strack < toc->first_track || strack > toc->last_track || - etrack < toc->first_track || etrack > toc->last_track || - strack > etrack) + etrack < toc->first_track || strack > etrack) goto errreq; int start = toc->toc[toc->first_track_offset + strack - 1].paddress; - int end = etrack == toc->last_track ? toc->lastaddress : toc->toc[toc->first_track_offset + etrack - 1 + 1].paddress; + int end = etrack >= toc->last_track ? toc->lastaddress : toc->toc[toc->first_track_offset + etrack - 1 + 1].paddress; sys_command_cd_pause (unitnum, 0); if (!sys_command_cd_play (unitnum, start, end, 0)) goto wrongtracktype; -- 2.47.3