Correct handling order of runtime options, followup #44

This commit is contained in:
extremecoders-re 2022-05-13 11:01:54 +03:00 committed by GitHub
commit 4dc147a379
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -275,12 +275,6 @@ class PyInstArchive:
os.chdir(extractionDir)
for entry in self.tocList:
basePath = os.path.dirname(entry.name)
if basePath != '':
# Check if path exists, create if not
if not os.path.exists(basePath):
os.makedirs(basePath)
self.fPtr.seek(entry.position, os.SEEK_SET)
data = self.fPtr.read(entry.cmprsdDataSize)
@ -290,6 +284,18 @@ class PyInstArchive:
# Comment out the assertion in such a case
assert len(data) == entry.uncmprsdDataSize # Sanity Check
if entry.typeCmprsData == b'd' or entry.typeCmprsData == b'o':
# d -> ARCHIVE_ITEM_DEPENDENCY
# o -> ARCHIVE_ITEM_RUNTIME_OPTION
# These are runtime options, not files
continue
basePath = os.path.dirname(entry.name)
if basePath != '':
# Check if path exists, create if not
if not os.path.exists(basePath):
os.makedirs(basePath)
if entry.typeCmprsData == b's':
# s -> ARCHIVE_ITEM_PYSOURCE
# Entry point are expected to be python scripts
@ -302,12 +308,6 @@ class PyInstArchive:
# packages and modules are pyc files with their header's intact
self._writeRawData(entry.name + '.pyc', data)
elif entry.typeCmprsData == b'd' or entry.typeCmprsData == b'o':
# d -> ARCHIVE_ITEM_DEPENDENCY
# o -> ARCHIVE_ITEM_RUNTIME_OPTION
# These are runtime options, not files
pass
else:
self._writeRawData(entry.name, data)