Fix LZEXE executables containing ZIPs being incorrectly extracted

This commit is contained in:
RichardG867
2022-05-12 18:28:54 -03:00
parent 0a79ed7541
commit 90b9f4fd0a

View File

@@ -2410,10 +2410,10 @@ class VMExtractor(ArchiveExtractor):
# All signatures should be within the first 32 KB or so.
extractor = None
extractor_kwargs = {}
if file_header[:2] == b'MZ':
if file_header[:2] == b'MZ' and b'PK\x03\x04' not in file_header: # skip self-extractors with compressed stubs
if file_header[28:32] == b'LZ91':
extractor = self._extract_lzexe
elif file_header[30:36] == b'PKLITE' and b'PK\x03\x04' not in file_header: # skip PKZIP self-extractor with PKLITE-compressed stub
elif file_header[30:36] == b'PKLITE':
extractor = self._extract_pklite
else:
match = self._floppy_pattern.search(file_header)