diff --git a/atrcopy/diskimages.py b/atrcopy/diskimages.py index c2532e7..4ea3802 100755 --- a/atrcopy/diskimages.py +++ b/atrcopy/diskimages.py @@ -130,6 +130,7 @@ class DiskImageBase(object): def setup(self): self.size = np.alen(self.bytes) self.read_atr_header() + self.header.check_size(self.size) self.check_size() self.get_boot_sector_info() self.get_vtoc() @@ -148,7 +149,7 @@ class DiskImageBase(object): self.header = XfdHeader() def check_size(self): - self.header.check_size(self.size) + pass def get_boot_sector_info(self): pass @@ -239,8 +240,6 @@ class BootDiskImage(DiskImageBase): return "%s Boot Disk" % (self.header) def check_size(self): - self.header.check_size(self.size) - start, size = self.header.get_pos(1) b = self.bytes i = self.header.atr_header_offset @@ -249,8 +248,12 @@ class BootDiskImage(DiskImageBase): raise InvalidDiskImage("Appears to be an executable") nsec = b[i + 1] bload = b[i + 2:i + 4].view(dtype=' max_sectors: + raise InvalidDiskImage("Number of boot sectors out of range") diff --git a/atrcopy/kboot.py b/atrcopy/kboot.py index 1687ef6..edf0623 100755 --- a/atrcopy/kboot.py +++ b/atrcopy/kboot.py @@ -39,9 +39,6 @@ class KBootImage(DiskImageBase): def __str__(self): return "%s KBoot Format: %d byte executable" % (self.header, self.files[0].exe_size) - def check_size(self): - self.header.check_size(self.size) - def check_sane(self): if not self.all_sane: raise InvalidDiskImage("Doesn't seem to be KBoot header")