mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
More sanity checking; if we get a good header followed immediately by a bad
one, then the header is no longer valid.
This commit is contained in:
@@ -69,19 +69,19 @@ SectorVector BrotherDecoder::decodeToSectors(const RawRecordVector& rawRecords,
|
||||
{
|
||||
case BROTHER_SECTOR_RECORD:
|
||||
{
|
||||
headerIsValid = false;
|
||||
if (rawrecord->data.size() < (32+32))
|
||||
{
|
||||
headerIsValid = false;
|
||||
break;
|
||||
}
|
||||
|
||||
nextTrack = decode_header_gcr(read_be16(toBytes(ii+32, ii+48)));
|
||||
nextSector = decode_header_gcr(read_be16(toBytes(ii+48, ii+64)));
|
||||
|
||||
/* Sanity check the sector; sector IDs above 11 can't exist but appear
|
||||
* occasionally due to read bit errors. */
|
||||
/* Sanity check the values read; there's no header checksum and
|
||||
* occasionally we get garbage due to bit errors. */
|
||||
if (nextSector > 11)
|
||||
break;
|
||||
if (nextTrack > 79)
|
||||
break;
|
||||
|
||||
headerIsValid = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user