Merge pull request #8487 from s-hadinger/unishox_py_fix

Fix unishox python
This commit is contained in:
Theo Arends 2020-05-19 21:59:14 +02:00 committed by GitHub
commit d3f1677c08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -47,10 +47,10 @@ class Unishox:
SHX_SET1B = 2
SHX_SET2 = 3
sets = [[0, ' ', 'e', 0, 't', 'a', 'o', 'i', 'n', 's', 'r'],
[0, 'l', 'c', 'd', 'h', 'u', 'p', 'm', 'b', 'g', 'w'],
['f', 'y', 'v', 'k', 'q', 'j', 'x', 'z', 0, 0, 0],
[0, '9', '0', '1', '2', '3', '4', '5', '6', '7', '8'],
sets = [['\0', ' ', 'e', '\0', 't', 'a', 'o', 'i', 'n', 's', 'r'],
['\0', 'l', 'c', 'd', 'h', 'u', 'p', 'm', 'b', 'g', 'w'],
['f', 'y', 'v', 'k', 'q', 'j', 'x', 'z', '\0', '\0', '\0'],
['\0', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8'],
['.', ',', '-', '/', '?', '+', ' ', '(', ')', '$', '@'],
[';', '#', ':', '<', '^', '*', '"', '{', '}', '[', ']'],
['=', '%', '\'', '>', '&', '_', '!', '\\', '|', '~', '`']]
@ -319,6 +319,8 @@ class Unishox:
code = 0
count = 0
while count < 5:
if bit_no_p >= len_:
return -1, bit_no_p
# detect marker
if self.ESCAPE_MARKER == inn[bit_no_p >> 3]:
bit_no_p += 8 # skip marker