Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
Incorrect handling of the archives with a long namespace fixed.
  • Loading branch information
TesterTesterov committed Dec 30, 2021
1 parent 4c6b89a commit 1df2347
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions ai5win_arc.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,19 @@ def hack_size_and_crypto_keys(input_file) -> tuple:
good_size = next_offset - start_offset
second_key = bad_size ^ good_size

try:
for entry in range(entry_count):
starter = 4 + entry*(8 + bytes_for_name)
input_file.seek(starter, 0)
new_bytes = input_file.read(bytes_for_name)
tester = b''
for i in new_bytes:
tester += struct.pack('B', i ^ first_key)
tester = tester.rstrip(b'\x00')
tester.decode(SilkyArc.name_encoding)
except UnicodeDecodeError:
continue

if good_size <= 0:
continue

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
)]

cx_Freeze.setup(
name="SilkyArcTool",
version="1.0",
name="AI5WINArcTool",
version="2.1",
description="Dual languaged (rus+eng) tool for packing and unpacking archives of Silky Engine.\n"
"Двуязычное средство (рус+англ) для распаковки и запаковки архивов Silky Engine.",
options={"build_exe": {"packages": []}},
Expand Down

0 comments on commit 1df2347

Please sign in to comment.