Commit 00beb81ea25a6670194b71e2a80caa9bb2c919f4
1 parent
46eb60f6
olevba: check_value now raises a warning instead of an error
Showing
1 changed file
with
5 additions
and
2 deletions
oletools/olevba.py
| @@ -234,7 +234,7 @@ from __future__ import print_function | @@ -234,7 +234,7 @@ from __future__ import print_function | ||
| 234 | # 2020-09-28 PL: - added VBA_Parser.get_vba_code_all_modules (partial fix | 234 | # 2020-09-28 PL: - added VBA_Parser.get_vba_code_all_modules (partial fix |
| 235 | # for issue #619) | 235 | # for issue #619) |
| 236 | 236 | ||
| 237 | -__version__ = '0.56' | 237 | +__version__ = '0.56.1dev1' |
| 238 | 238 | ||
| 239 | #------------------------------------------------------------------------------ | 239 | #------------------------------------------------------------------------------ |
| 240 | # TODO: | 240 | # TODO: |
| @@ -1986,7 +1986,10 @@ class VBA_Project(object): | @@ -1986,7 +1986,10 @@ class VBA_Project(object): | ||
| 1986 | def check_value(self, name, expected, value): | 1986 | def check_value(self, name, expected, value): |
| 1987 | if expected != value: | 1987 | if expected != value: |
| 1988 | if self.relaxed: | 1988 | if self.relaxed: |
| 1989 | - log.error("invalid value for {0} expected {1:04X} got {2:04X}" | 1989 | + # It happens quite often that some values do not strictly follow |
| 1990 | + # the MS-OVBA specifications, and this does not prevent the VBA | ||
| 1991 | + # code from being extracted, so here we only raise a warning: | ||
| 1992 | + log.warning("invalid value for {0} expected {1:04X} got {2:04X}" | ||
| 1990 | .format(name, expected, value)) | 1993 | .format(name, expected, value)) |
| 1991 | else: | 1994 | else: |
| 1992 | raise UnexpectedDataError(self.dir_path, name, expected, value) | 1995 | raise UnexpectedDataError(self.dir_path, name, expected, value) |