mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 15:48:13 +00:00
Fix parsing issue when int parameter is in base 16
Fix error `ValueError: invalid literal for int() with base 10:` that is caused when a parameter is given in base 16. Use relevant base when calling `int()` function.
This commit is contained in:
parent
e81ff54881
commit
7c52e229d5
1 changed files with 2 additions and 1 deletions
|
@ -80,6 +80,7 @@ class TestDataParser(object):
|
||||||
if len(split_char) > 1:
|
if len(split_char) > 1:
|
||||||
raise ValueError('Expected split character. Found string!')
|
raise ValueError('Expected split character. Found string!')
|
||||||
out = list(map(split_colon_fn, re.split(r'(?<!\\)' + split_char, inp_str)))
|
out = list(map(split_colon_fn, re.split(r'(?<!\\)' + split_char, inp_str)))
|
||||||
|
out = [x for x in out if x]
|
||||||
return out
|
return out
|
||||||
|
|
||||||
def __parse(self, data_f):
|
def __parse(self, data_f):
|
||||||
|
@ -260,7 +261,7 @@ class MbedTlsTest(BaseHostTest):
|
||||||
data_bytes += bytearray([function_id, len(parameters)])
|
data_bytes += bytearray([function_id, len(parameters)])
|
||||||
for typ, param in parameters:
|
for typ, param in parameters:
|
||||||
if typ == 'int' or typ == 'exp':
|
if typ == 'int' or typ == 'exp':
|
||||||
i = int(param)
|
i = int(param, 0)
|
||||||
data_bytes += b'I' if typ == 'int' else b'E'
|
data_bytes += b'I' if typ == 'int' else b'E'
|
||||||
self.align_32bit(data_bytes)
|
self.align_32bit(data_bytes)
|
||||||
data_bytes += self.int32_to_big_endian_bytes(i)
|
data_bytes += self.int32_to_big_endian_bytes(i)
|
||||||
|
|
Loading…
Reference in a new issue