From ea339fb2ec780077871b010e0c46cd7ff0541a61 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 24 Sep 2025 04:13:41 +0100 Subject: [PATCH] Return invalid field if asked for a TOC and disc is a blank disc in CD drives. --- src/scsi/scsi_cdrom.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/scsi/scsi_cdrom.c b/src/scsi/scsi_cdrom.c index a4858ef23..9dd5fb65d 100644 --- a/src/scsi/scsi_cdrom.c +++ b/src/scsi/scsi_cdrom.c @@ -2642,6 +2642,12 @@ scsi_cdrom_command(scsi_common_t *sc, const uint8_t *cdb) if (dev->drv->ops == NULL) scsi_cdrom_not_ready(dev); else if (toc_format < 3) { + // Blank discs return invalid field when asked for a TOC + if (dev->drv->cd_status & CD_STATUS_BLANK_MASK) { + scsi_cdrom_invalid_field(dev, toc_format); + break; + } + len = cdrom_read_toc(dev->drv, dev->buffer, toc_format, cdb[6], msf, max_len); /* If the returned length is -1, this means cdrom_read_toc() has encountered an error. */ if (len == -1)