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

logging errors when files have non-unicode character file names #69

Open
armijnhemel opened this issue Mar 2, 2021 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@armijnhemel
Copy link
Owner

armijnhemel commented Mar 2, 2021

Error with Python's testtar.tar archive:

$ python3 bang-scanner -f /tmp/testtar.tar
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib64/python3.9/logging/__init__.py", line 1082, in emit
    stream.write(msg + self.terminator)
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 50-56: surrogates not allowed
Call stack:
  File "/home/armijn/tmp/binaryanalysis-ng/src/bang-scanner", line 414, in <module>
    main(sys.argv)
  File "/home/armijn/tmp/binaryanalysis-ng/src/bang-scanner", line 294, in main
    process.start()
  File "/usr/lib64/python3.9/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
  File "/usr/lib64/python3.9/multiprocessing/context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "/usr/lib64/python3.9/multiprocessing/context.py", line 277, in _Popen
    return Popen(process_obj)
  File "/usr/lib64/python3.9/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/usr/lib64/python3.9/multiprocessing/popen_fork.py", line 71, in _launch
    code = process_obj._bootstrap(parent_sentinel=child_r)
  File "/usr/lib64/python3.9/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib64/python3.9/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/armijn/tmp/binaryanalysis-ng/src/ScanJob.py", line 694, in processfile
    scanjob.check_entire_file(unpacker)
  File "/home/armijn/tmp/binaryanalysis-ng/src/ScanJob.py", line 556, in check_entire_file
    log(logging.DEBUG, "TRYING %s %s at offset: 0" %
  File "/home/armijn/tmp/binaryanalysis-ng/src/banglogging.py", line 7, in log
    logging.log(level, message)
Message: 'TRYING testtar.tar-0x00000000-tar-1/ustar/umlauts-\udcc4\udcd6\udcdc\udce4\udcf6\udcfc\udcdf script at offset: 0'
@armijnhemel armijnhemel self-assigned this Mar 2, 2021
@armijnhemel armijnhemel added the bug Something isn't working label Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant