diff --git a/atrcopy/ataridos.py b/atrcopy/ataridos.py index 13ea71d..f49817b 100644 --- a/atrcopy/ataridos.py +++ b/atrcopy/ataridos.py @@ -202,6 +202,23 @@ class AtariDosDiskImage(DiskImageBase): ('unused',' self.calc_vtoc_code(): + raise InvalidDiskImage("Invalid number of VTOC sectors: %d" % num) + self.total_sectors = values[1] self.unused_sectors = values[2] if self.header.image_size == 133120: diff --git a/atrcopy/diskimages.py b/atrcopy/diskimages.py index 5173214..cfb0dd0 100644 --- a/atrcopy/diskimages.py +++ b/atrcopy/diskimages.py @@ -130,6 +130,10 @@ class DiskImageBase(object): self.get_directory() self.check_sane() + def assert_valid_sector(self, sector): + if not self.header.sector_is_valid(sector): + raise ByteNotInFile166("Sector %d out of range" % sector) + def check_sane(self): if not self.all_sane: raise InvalidDiskImage("Invalid directory entries; may be boot disk")