kaitai-io / kaitai_struct_formats

Kaitai Struct: library of binary file formats (.ksy)
http://formats.kaitai.io
712 stars 203 forks source link

MachO parser can't handle fat binaries #612

Closed mikehearn closed 2 years ago

mikehearn commented 2 years ago

MachO files can be effectively glued together with a small header that indicates this has happened, Apple calls this a "fat" binary.

https://www.symbolcrash.com/2019/02/26/mach-o-universal-fat-binaries/

The current mach_o.ksy doesn't know about this and also doesn't check the magic at the start, so just crashes when trying to read a fat binary.

generalmimon commented 2 years ago

I suppose the pull request #515 should add support for the "fat" format.

mikehearn commented 2 years ago

Ah! Thank you! I did search but didn't find that PR, I think I was spelling MachO / Mach-O differently :/

That PR does indeed look like what's needed. Any reason it wasn't merged, or just waiting review?

generalmimon commented 2 years ago

Any reason it wasn't merged, or just waiting review?

Just awaiting review.

woodruffw commented 2 years ago

Is there a Kaitai maintainer capable of reviewing that PR? I'm another potential user of it.

I can also do a review as an independent user (one who's intimately familiar with Mach-O), but I figured I'd hold off until someone from the project itself can chime in.

mikehearn commented 2 years ago

FWIW I've been using it for a while now and it seems to work fine.

generalmimon commented 2 years ago

Resolved by https://github.com/kaitai-io/kaitai_struct_formats/pull/515