Commit ce32342a538f5455990db0f548c1310453658858
1 parent
158ae461
olevba: fixed bug in extract_macros
Showing
1 changed file
with
10 additions
and
7 deletions
oletools/olevba.py
| ... | ... | @@ -175,9 +175,9 @@ https://github.com/unixfreak0037/officeparser |
| 175 | 175 | # 2016-05-12 CH: - added support for PowerPoint 97-2003 files |
| 176 | 176 | # 2016-06-06 CH: - improved handling of unicode VBA module names |
| 177 | 177 | # 2016-06-07 CH: - added option --relaxed, stricter parsing by default |
| 178 | -# 2016-06-12 v0.48 PL: - fixed small bugs in VBA parsing code | |
| 178 | +# 2016-06-12 v0.47.1 PL: - fixed small bugs in VBA parsing code | |
| 179 | 179 | |
| 180 | -__version__ = '0.48' | |
| 180 | +__version__ = '0.47.1' | |
| 181 | 181 | |
| 182 | 182 | #------------------------------------------------------------------------------ |
| 183 | 183 | # TODO: |
| ... | ... | @@ -2654,11 +2654,14 @@ class VBA_Parser(object): |
| 2654 | 2654 | start = match.start() - 3 |
| 2655 | 2655 | log.debug('Found VBA compressed code at index %X' % start) |
| 2656 | 2656 | compressed_code = data[start:] |
| 2657 | - vba_code = decompress_stream(compressed_code) | |
| 2658 | - yield (self.filename, d.name, d.name, vba_code) | |
| 2659 | - | |
| 2660 | - | |
| 2661 | - | |
| 2657 | + try: | |
| 2658 | + vba_code = decompress_stream(compressed_code) | |
| 2659 | + yield (self.filename, d.name, d.name, vba_code) | |
| 2660 | + except Exception as exc: | |
| 2661 | + # display the exception with full stack trace for debugging | |
| 2662 | + log.debug('Error processing stream %r in file %r (%s)' % (d.name, self.filename, exc)) | |
| 2663 | + log.debug('Traceback:', exc_info=True) | |
| 2664 | + # do not raise the error, as it is unlikely to be a compressed macro stream | |
| 2662 | 2665 | |
| 2663 | 2666 | def extract_all_macros(self): |
| 2664 | 2667 | """ | ... | ... |