Port-amiga archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Off-by-one CD-ROM bug (was Re: Possible problem with accessing DVDs larger than 4GB)



Hi,

Following up on my previous message...

On Sun, March 3, 2013 21:16, Mark wrote:
>> I did some more testing. At least in WinUAE (A3000, SCSI CD drive),
>> NetBSD
>> 2.1 doesn't have that problem. It reads all 19057 sectors from the disc.
>> And the same with NetBSD 1.6.2 with emulated A4000 and ATAPI CD drive.
>>
>> So this issue could possibly be a regression in later NetBSD versions.
>> Or
>> it could be an emulation bug if earlier versions somehow accessed CDs
>> differently.
>
> After some more testing, it seems NetBSD 3.1 doesn't have the off-by-one
> problem, but both NetBSD 4.0.1 and 5.2 do. So if this *is* actually a
> NetBSD bug, the regression appeared somewhere between 3.1 and 4.0.1.

This is actually a bug in NetBSD; I'm surprised no-one else noticed it
before. I have filed a report at the netbsd.org bug tracker, but if anyone
is interested...

The bug is in src/sys/dev/scsipi.cd.c, in the read_cd_capacity() function.
The bug was first introduced in version 1.227:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/scsipi/cd.c?annotate=1.227
Compare with 1.226:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/scsipi/cd.c?annotate=1.227

The line
*size = _4btol(data.addr);
should be changed to read
*size = _4btol(data.addr) + 1;


-- Mark





Home | Main Index | Thread Index | Old Index