Hi David,
On 17/07/23 20:00, David Laight wrote:
From: Michael Schmitz
Sent: 16 July 2023 00:27
The Amiga partition parser module uses signed int for partition sector address and count, which will overflow for disks larger than 1 TB.
Use u64 as type for sector address and size to allow using disks up to 2 TB without LBD support, and disks larger than 2 TB with LBD. The RBD format allows to specify disk sizes up to 2^128 bytes (though native OS limitations reduce this somewhat, to max 2^68 bytes),
Pretty much everything (including the mass of an proton) stops you having a disk with anywhere near 2^64 bytes in it.
I put my hopes on all that dark matter we still seem to be missing then.
Seriously though - RDB allows for this size, no matter how unlikely. 2^32 heads or 2^32 sectors per track would have been seen as impossible when RDB was designed. On the other hand, the '16 bit address space ought to be enough for everybody' was probably still fresh in the mind of the Amiga developers at that time.
All that matters is that we get the size calculations right (and then let the partition core enforce the known disk size limit).
Cheers,
Michael
David
so check for u64 overflow carefully to protect against overflowing sector_t.
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)