Commit 749e9ebc55a6748e1fd334169e14ae99fe6f5338

Authored by Christian Herdtweck
1 parent cbd3f779

deal with 2 errors that appeared in first tests (and corrected an indentation)

Showing 1 changed file with 6 additions and 2 deletions
oletools/olevba.py
@@ -2174,6 +2174,7 @@ class VBA_Parser(object): @@ -2174,6 +2174,7 @@ class VBA_Parser(object):
2174 except Exception as exc: 2174 except Exception as exc:
2175 # TODO: differentiate exceptions for each parsing stage 2175 # TODO: differentiate exceptions for each parsing stage
2176 # (but ET is different libs, no good exception description in API) 2176 # (but ET is different libs, no good exception description in API)
  2177 + # found: XMLSyntaxError
2177 log.exception('Failed XML parsing for file %r (%s)' % (self.filename, exc)) 2178 log.exception('Failed XML parsing for file %r (%s)' % (self.filename, exc))
2178 2179
2179 def open_mht(self, data): 2180 def open_mht(self, data):
@@ -2230,12 +2231,15 @@ class VBA_Parser(object): @@ -2230,12 +2231,15 @@ class VBA_Parser(object):
2230 % (fname, exc)) 2231 % (fname, exc))
2231 else: 2232 else:
2232 log.debug('type(part_data) = %s' % type(part_data)) 2233 log.debug('type(part_data) = %s' % type(part_data))
2233 - log.debug('part_data[0:20] = %r' % part_data[0:20]) 2234 + try:
  2235 + log.debug('part_data[0:20] = %r' % part_data[0:20])
  2236 + except TypeError as err:
  2237 + log.debug('part_data has no __getitem__')
2234 # set type only if parsing succeeds 2238 # set type only if parsing succeeds
2235 self.type = TYPE_MHTML 2239 self.type = TYPE_MHTML
2236 except Exception: 2240 except Exception:
2237 log.exception('Failed MIME parsing for file %r - %s' 2241 log.exception('Failed MIME parsing for file %r - %s'
2238 - % (self.filename, MSG_OLEVBA_ISSUES)) 2242 + % (self.filename, MSG_OLEVBA_ISSUES))
2239 2243
2240 2244
2241 def open_text(self, data): 2245 def open_text(self, data):