Attempt to handle bad track/sector list in DOS 3.3 image

This commit is contained in:
Rob McMullen 2016-07-28 19:37:40 -07:00
parent f6a929f915
commit 71268cd0fa

View File

@ -112,11 +112,16 @@ class Dos33Dirent(object):
if not self.is_sane:
raise InvalidDirent("Invalid directory entry '%s'" % str(self))
self.get_track_sector_list(image)
log.debug("start_read: %s, t/s list: %s" % (str(self), str(self.sector_map)))
self.current_sector_index = 0
self.current_read = self.num_sectors
def read_sector(self, image):
sector = self.sector_map[self.current_sector_index]
log.debug("read_sector: index=%d in %s" % (self.current_sector_index, str(self)))
try:
sector = self.sector_map[self.current_sector_index]
except IndexError:
sector = -1
last = (self.current_sector_index == len(self.sector_map) - 1)
raw, pos, size = image.get_raw_bytes(sector)
bytes, num_data_bytes = self.process_raw_sector(image, raw)