diff options
| author | jvoisin | 2018-10-25 11:56:12 +0200 |
|---|---|---|
| committer | jvoisin | 2018-10-25 11:56:12 +0200 |
| commit | 283e5e57877b21e34eb4612d3201c2e0682190d5 (patch) | |
| tree | 05dc4be721c1bbb43cba9e2d8049d2d618f51b59 | |
| parent | 513d897ea0cf3e006a2b33a89cdbf33cae3592cd (diff) | |
Improve archive-based parser's robustness against corrupted embedded files
| -rw-r--r-- | libmat2/archive.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libmat2/archive.py b/libmat2/archive.py index 80e0bf2..b4700c3 100644 --- a/libmat2/archive.py +++ b/libmat2/archive.py | |||
| @@ -138,7 +138,13 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser): | |||
| 138 | abort = True | 138 | abort = True |
| 139 | continue | 139 | continue |
| 140 | if tmp_parser: | 140 | if tmp_parser: |
| 141 | tmp_parser.remove_all() | 141 | if tmp_parser.remove_all() is False: |
| 142 | logging.warning("In file %s, something went wrong \ | ||
| 143 | with the cleaning of %s \ | ||
| 144 | (format: %s)", | ||
| 145 | self.filename, item.filename, mtype) | ||
| 146 | abort = True | ||
| 147 | continue | ||
| 142 | os.rename(tmp_parser.output_filename, full_path) | 148 | os.rename(tmp_parser.output_filename, full_path) |
| 143 | 149 | ||
| 144 | zinfo = zipfile.ZipInfo(item.filename) # type: ignore | 150 | zinfo = zipfile.ZipInfo(item.filename) # type: ignore |
