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

KeyError in list_macho_flags #13

Closed
rammy22 opened this issue Sep 20, 2017 · 2 comments
Closed

KeyError in list_macho_flags #13

rammy22 opened this issue Sep 20, 2017 · 2 comments
Assignees
Labels

Comments

@rammy22
Copy link

rammy22 commented Sep 20, 2017

Could not parse file: /sample/1824ed42581e489a7e916faf9f3967ef77844e6775cd29c87ff6ac314ebca0fc
ERROR:root:Traceback (most recent call last):
  File "/.virtualenvs/tmp-6c7055859c255549/lib/python2.7/site-packages/macholibre/__init__.py", line 67, in main
    parse(args.input[0], f=args.output)
  File "/.virtualenvs/tmp-6c7055859c255549/lib/python2.7/site-packages/macholibre/__init__.py", line 41, in parse
    p.parse_file()
  File "/.virtualenvs/tmp-6c7055859c255549/lib/python2.7/site-packages/macholibre/parser.py", line 814, in parse_file
    endi=identity[1], size=self.get_file_size()))
  File "/.virtualenvs/tmp-6c7055859c255549/lib/python2.7/site-packages/macholibre/parser.py", line 736, in parse_macho
    flags = self.list_macho_flags(flags)
  File "/.virtualenvs/tmp-6c7055859c255549/lib/python2.7/site-packages/macholibre/parser.py", line 90, in list_macho_flags
    l.append(dictionary.flags[2 ** j])
KeyError: 67108864
@aaronst
Copy link
Owner

aaronst commented Mar 13, 2018

@rammy22 Opening this up in a hex editor, this doesn't appear to be a mach-o file at all. Trying to think of a good solution to reject these files that use mach-o magic values but aren't actually mach-o's...

@aaronst aaronst self-assigned this Mar 20, 2018
@aaronst
Copy link
Owner

aaronst commented Mar 20, 2018

I added some more checks to the earlier stages of parsing. It handles this case.

@aaronst aaronst closed this as completed Mar 20, 2018
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants