Commit 20bcb6885c62e448fea348f58a79c07fc6d11a74

Authored by decalage2
1 parent 00beb81e

olevba: improved error logs, added some comments

Showing 1 changed file with 4 additions and 2 deletions
oletools/olevba.py
... ... @@ -1384,9 +1384,9 @@ def decompress_stream(compressed_container):
1384 1384 # in chunk header before adding 3.
1385 1385 # Also the first test is not useful since a 12 bits value cannot be larger than 4095.
1386 1386 if chunk_flag == 1 and chunk_size > 4098:
1387   - raise ValueError('CompressedChunkSize > 4098 but CompressedChunkFlag == 1')
  1387 + raise ValueError('CompressedChunkSize=%d > 4098 but CompressedChunkFlag == 1' % chunk_size)
1388 1388 if chunk_flag == 0 and chunk_size != 4098:
1389   - raise ValueError('CompressedChunkSize != 4098 but CompressedChunkFlag == 0')
  1389 + raise ValueError('CompressedChunkSize=%d != 4098 but CompressedChunkFlag == 0' % chunk_size)
1390 1390  
1391 1391 # check if chunk_size goes beyond the compressed data, instead of silently cutting it:
1392 1392 #TODO: raise an exception?
... ... @@ -3423,6 +3423,8 @@ class VBA_Parser(object):
3423 3423 for vba_root, project_path, dir_path in self.vba_projects:
3424 3424 # extract all VBA macros from that VBA root storage:
3425 3425 # The function _extract_vba may fail on some files (issue #132)
  3426 + # TODO: refactor this loop, because if one module fails it stops parsing,
  3427 + # and the error is only logged, not stored for reporting anomalies
3426 3428 try:
3427 3429 for stream_path, vba_filename, vba_code in \
3428 3430 _extract_vba(self.ole_file, vba_root, project_path,
... ...