mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-27 06:14:58 +03:00
qrdecode: fix infinite loop when encoding type is 1 (numeric)
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
This commit is contained in:
parent
d4a7ca080e
commit
66f4a852a9
@ -223,11 +223,15 @@ def parse_bits(bits, version):
|
|||||||
while l > 0:
|
while l > 0:
|
||||||
if l >= 3:
|
if l >= 3:
|
||||||
num, bits = bits_to_int(bits[:10]), bits[10:]
|
num, bits = bits_to_int(bits[:10]), bits[10:]
|
||||||
|
l -= 3
|
||||||
elif l >= 2:
|
elif l >= 2:
|
||||||
num, bits = bits_to_int(bits[:7]), bits[7:]
|
num, bits = bits_to_int(bits[:7]), bits[7:]
|
||||||
|
l -= 2
|
||||||
else:
|
else:
|
||||||
num, bits = bits_to_int(bits[:3]), bits[3:]
|
num, bits = bits_to_int(bits[:3]), bits[3:]
|
||||||
|
l -= 1
|
||||||
buf += str(num)
|
buf += str(num)
|
||||||
|
return buf, bits
|
||||||
elif enc == 2: # Alphanumeric
|
elif enc == 2: # Alphanumeric
|
||||||
n_l = 9 if version < 10 else 11 if version < 27 else 13
|
n_l = 9 if version < 10 else 11 if version < 27 else 13
|
||||||
l, bits = bits_to_int(bits[:n_l]), bits[n_l:]
|
l, bits = bits_to_int(bits[:n_l]), bits[n_l:]
|
||||||
|
Loading…
Reference in New Issue
Block a user