Skip to content

Commit 8181f0c

Browse files
Fix Simg2img
1 parent 2d82386 commit 8181f0c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lpunpack.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -643,19 +643,19 @@ def unsparse(self):
643643
if chunk_header.chunk_type == 0xCAC2:
644644
data = self._read_data(chunk_data_size)
645645
len_data = sector_size << 9
646-
out.write(struct.pack("B", 0) * len_data)
646+
out.truncate(out.tell() + len_data)
647647
output_len += len(data)
648648
sector_base += sector_size
649649
else:
650650
if chunk_header.chunk_type == 0xCAC3:
651651
data = self._read_data(chunk_data_size)
652652
len_data = sector_size << 9
653-
out.write(struct.pack("B", 0) * len_data)
653+
out.truncate(out.tell() + len_data)
654654
output_len += len(data)
655655
sector_base += sector_size
656656
else:
657657
len_data = sector_size << 9
658-
out.write(struct.pack("B", 0) * len_data)
658+
out.truncate(out.tell() + len_data)
659659
sector_base += sector_size
660660
chunks -= 1
661661
return unsparse_file

0 commit comments

Comments
 (0)