Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fat parser should fail on file with 0 architectures #139

Open
woodruffw opened this issue Mar 15, 2019 · 0 comments
Open

Fat parser should fail on file with 0 architectures #139

woodruffw opened this issue Mar 15, 2019 · 0 comments

Comments

@woodruffw
Copy link
Member

Currently, ruby-macho will happily parse a fat Mach-O with no internal slices (i.e., nfat_arch == 0). This should be an error (potentially an ignorable one with permissive: true).

Reference this LLVM object: https://github.com/llvm-mirror/llvm/blob/master/test/Object/Inputs/macho-invalid-fat-header

Observed behavior:

>> MachO.open('macho-invalid-fat-header')
#<MachO::FatFile:0x000055776df6b2a8 @filename="macho-invalid-fat-header", @options={}, @raw_data="\xCA\xFE\xBA\xBE\x00\x00\x00\x00", @header=#<MachO::Headers::FatHeader:0x000055776df6b118 @magic=3405691582, @nfat_arch=0>, @fat_archs=[], @machos=[]>

Expected behavior:

An exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant