diskfs / go-diskfs

MIT License
515 stars 113 forks source link

separate reading of GPT table and partition entries #158

Closed deitch closed 1 year ago

deitch commented 1 year ago

Fixes #157

When we read the GPT table, we read the bytes necessary for table including assumed partition entries, then try to parse them all.

This doesn't work, because our assumptions of the partition entries could very well be wrong.

This PR changes it to a few steps:

  1. Read the bytes just for the GPT header
  2. Parse and validate those
  3. Using the data from the header, read the bytes for the partition entries
  4. Validate the checksum on the bytes for the partition entries
  5. Parse the partition entries and add to the table struct
deitch commented 1 year ago

@carbonin see here.