Return invalid field if asked for a TOC and disc is a blank disc in CD drives.

This commit is contained in:
2025-09-24 04:13:41 +01:00
parent 7efcbddc80
commit ea339fb2ec

View File

@@ -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)