Skip to content

Commit

Permalink
Fixed some logic responsible to handle too short PFS0 header sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
seiya-git committed Jan 1, 2024
1 parent ec580d7 commit 56c01ac
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions py/nstools/Fs/Pfs0.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def getStringTableSize(self):
stringTableSizePadded = len(stringTableNonPadded) + self.allign0x20(headerSizeNonPadded)
if self._stringTableSize == None:
self._stringTableSize = stringTableSizePadded
if stringTableSizePadded > self._stringTableSize:
self._stringTableSize = stringTableSizePadded
elif len(stringTableNonPadded) > self._stringTableSize:
self._stringTableSize = len(stringTableNonPadded)
return self._stringTableSize

def getFirstFileOffset(self):
Expand Down Expand Up @@ -156,8 +156,8 @@ def getStringTableSize(self):
stringTableSizePadded = len(stringTableNonPadded) + self.allign0x20(headerSizeNonPadded)
if self._stringTableSize == None:
self._stringTableSize = stringTableSizePadded
if stringTableSizePadded > self._stringTableSize:
self._stringTableSize = stringTableSizePadded
elif len(stringTableNonPadded) > self._stringTableSize:
self._stringTableSize = len(stringTableNonPadded)
return self._stringTableSize

def getHash(self):
Expand All @@ -173,7 +173,7 @@ def getHeaderHash(self):
h = b''
h += b'PFS0'
h += len(self.files).to_bytes(4, byteorder='little')
h += (self.getStringTableSize()).to_bytes(4, byteorder='little')
h += (stringTableSizePadded).to_bytes(4, byteorder='little')
h += b'\x00\x00\x00\x00'

stringOffset = 0
Expand Down

0 comments on commit 56c01ac

Please sign in to comment.