1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Enforces a maximum sector size to avoid impossible sizes.

Such as 128 * 2^255.
This commit is contained in:
Thomas Harte 2018-03-22 22:00:26 -04:00
parent 45be1c19df
commit 3bb496f9ae

View File

@ -56,7 +56,7 @@ std::map<std::size_t, Storage::Encodings::MFM::Sector> Storage::Encodings::MFM::
case 2: new_sector->address.sector = shifter.get_byte(); ++position; break; case 2: new_sector->address.sector = shifter.get_byte(); ++position; break;
case 3: case 3:
new_sector->size = shifter.get_byte(); new_sector->size = shifter.get_byte();
size = static_cast<std::size_t>(128 << new_sector->size); size = static_cast<std::size_t>(128 << (new_sector->size&7));
++position; ++position;
is_reading = false; is_reading = false;
shifter.set_should_obey_syncs(true); shifter.set_should_obey_syncs(true);