Skip to content

Commit

Permalink
Fix ISOs with missing Apple partition map entries.
Browse files Browse the repository at this point in the history
We've seen ISOs in the wild (Fedora 34 Workstation DVD) that
have an Apple partition entry, but are missing the APM headers.
Detect this situation and skip the parsing as needed.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
  • Loading branch information
clalancette committed Apr 29, 2021
1 parent 9aa4568 commit 6f0f7b6
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pycdlib/isohybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,17 @@ def parse_primary(self, instr, mac):
offset = 512
offset += self.header.parse(instr[offset:])
if mac:
# Now go looking for the APMs
# Now go looking for the APMs. Note that we've seen ISOs in the
# wild (Fedora 34 Workstation DVD) with Apple partition entries,
# but no APM parts. If we see all zeros where we expect the
# first APM part, we skip the parsing here.
offset = 2048
for i_unused in range(0, APM_PARTS):
apm_part = APMPartHeader()
apm_part.parse(instr[offset:])
self.apm_parts.append(apm_part)
offset += 2048
if instr[offset:offset + 2] != b'\x00\x00':
for i_unused in range(0, APM_PARTS):
apm_part = APMPartHeader()
apm_part.parse(instr[offset:])
self.apm_parts.append(apm_part)
offset += 2048

offset = self.header.partition_entries_lba * 512
for i_unused in range(0, self.header.num_parts):
Expand Down

0 comments on commit 6f0f7b6

Please # to comment.