Skip to content

Commit ceb5e74

Browse files
committed
fix(bug): compute the msi length from header
Don't assume that pymsi will actually read the entire file.
1 parent 4e0a7b3 commit ceb5e74

File tree

1 file changed

+4
-2
lines changed
  • python/unblob/handlers/archive

1 file changed

+4
-2
lines changed

python/unblob/handlers/archive/msi.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ def calculate_chunk(self, file: File, start_offset: int) -> Optional[ValidChunk]
5454
package = pymsi.Package(file)
5555
msi = pymsi.Msi(package, False)
5656

57-
# MSI moves the file pointer
58-
msi_end_offset = file.tell()
57+
# multiply the number of sectors by the sector size, plus 512 for header
58+
msi_size = (msi.package.ole.nb_sect * msi.package.ole.sector_size) + 512
59+
60+
msi_end_offset = start_offset + msi_size
5961

6062
return ValidChunk(
6163
start_offset = start_offset,

0 commit comments

Comments
 (0)