Skip to content

Commit

Permalink
Fix TypeError in VBA_Parser.analyze_macros() (can't concat bytes to s…
Browse files Browse the repository at this point in the history
…tr).

Similar to PR #288.

`decompress_stream()` yields bytes but vba_code value returned from
`extract_macros()` should be AFAIK string in Python 3.
  • Loading branch information
enkelli committed Nov 29, 2019
1 parent f6c9d40 commit 3e9d763
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion oletools/olevba.py
Original file line number Diff line number Diff line change
Expand Up @@ -3273,7 +3273,8 @@ def extract_macros(self):
compressed_code = data[start:]
try:
vba_code = decompress_stream(bytearray(compressed_code))
# TODO vba_code = self.encode_string(vba_code)
encoding = chardet.detect(vba_code)['encoding'] or 'utf-8'
vba_code = bytes2str(vba_code, encoding)
yield (self.filename, d.name, d.name, vba_code)
except Exception as exc:
# display the exception with full stack trace for debugging
Expand Down

0 comments on commit 3e9d763

Please sign in to comment.