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

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfd in position 3: invalid start byte #21

Open
LubosD opened this issue Aug 27, 2018 · 5 comments
Assignees

Comments

@LubosD
Copy link

LubosD commented Aug 27, 2018

This happens to me when I try to parse a core dump Mach-O file:

$ macholibre core.16057 
Traceback (most recent call last):
  File "/home/lubos/.local/bin/macholibre", line 11, in <module>
    load_entry_point('macholibre==1.0', 'console_scripts', 'macholibre')()
  File "/home/lubos/.local/lib64/python3.6/site-packages/macholibre/__init__.py", line 70, in main
    print(dumps(parse(args.input[0])))
  File "/home/lubos/.local/lib64/python3.6/site-packages/macholibre/__init__.py", line 45, in parse
    return parser.parse()
  File "/home/lubos/.local/lib64/python3.6/site-packages/macholibre/parser.py", line 1680, in parse
    self.parse_file()
  File "/home/lubos/.local/lib64/python3.6/site-packages/macholibre/parser.py", line 1671, in parse_file
    self.parse_macho(0, self.__output['size'])
  File "/home/lubos/.local/lib64/python3.6/site-packages/macholibre/parser.py", line 1588, in parse_macho
    self.parse_lcs(offset, size, nlcs, slcs)
  File "/home/lubos/.local/lib64/python3.6/site-packages/macholibre/parser.py", line 791, in parse_lcs
    self.parse_segment(offset, size, cmd, cmd_size))
  File "/home/lubos/.local/lib64/python3.6/site-packages/macholibre/parser.py", line 230, in parse_segment
    name = self.__file.read(16).decode().rstrip('\u0000')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfd in position 3: invalid start byte
@aaronst
Copy link
Owner

aaronst commented Aug 27, 2018

@LubosD thanks for the info, I'll take a look.

@aaronst aaronst self-assigned this Aug 27, 2018
@jshlbrd
Copy link

jshlbrd commented Apr 3, 2019

Adding to this issue -- I'm experiencing a similar (the same?) error when using the package.

 Traceback (most recent call last):
   File "[redacted]", line 237, in [redacted]
     [redacted]
   File "[redacted]", line 26, in [redacted]
     macho_dictionary = macholibre.parse(f.name)
   File "/usr/local/lib/python3.6/dist-packages/macholibre/__init__.py", line 45, in parse
     return parser.parse()
   File "/usr/local/lib/python3.6/dist-packages/macholibre/parser.py", line 1680, in parse
     self.parse_file()
   File "/usr/local/lib/python3.6/dist-packages/macholibre/parser.py", line 1671, in parse_file
     self.parse_macho(0, self.__output['size'])
   File "/usr/local/lib/python3.6/dist-packages/macholibre/parser.py", line 1588, in parse_macho
     self.parse_lcs(offset, size, nlcs, slcs)
   File "/usr/local/lib/python3.6/dist-packages/macholibre/parser.py", line 791, in parse_lcs
     self.parse_segment(offset, size, cmd, cmd_size))
   File "/usr/local/lib/python3.6/dist-packages/macholibre/parser.py", line 230, in parse_segment
     name = self.__file.read(16).decode().rstrip('\u0000')
 UnicodeDecodeError: 'utf-8' codec can't decode byte 0x99 in position 14: invalid start byte

@aaronst
Copy link
Owner

aaronst commented May 9, 2019

@jshlbrd , do you have a hash I can use to test?

@jshlbrd
Copy link

jshlbrd commented May 24, 2019

@aaronst yep, try this one: be55e8952a262d0e524239dbf82191ed

@Happyholic1203
Copy link

@aaronst I attempted a fix on python2 branch here: #28

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

No branches or pull requests

4 participants