darlinghq / darling-dmg

FUSE module for .dmg files (containing an HFS+ filesystem)
http://www.darlinghq.org
GNU General Public License v3.0
273 stars 45 forks source link

Strange HFSX files inside IPSW firmware #62

Closed tomkoen closed 6 years ago

tomkoen commented 6 years ago

IPSW iOS firmware files contain number of DMG files, which are actually simple HFSX raw file system. Examples: https://www.dropbox.com/s/0zpx0b52thrfawm/058-97112-138.dmg?dl=0 https://www.dropbox.com/s/tcc0qhn27md1njp/058-97541-138.dmg?dl=0

The problem is that these files have special 27 bytes offset before actual HFS data: sshot-2018-07-08- 15-25-12

7Zip is smart to handle such files, but in my code I have to do the following tweak:

ioReader->setStartOffset((ioReader->length() % 512));

Is it OK? Can this be implemented in the lib?

Thank you

LubosD commented 6 years ago

This change does not look safe, I'd instead detect this unusual header.

tomkoen commented 6 years ago

You're right, thanks for the advice.