Skip to content

Commit 666e61b

Browse files
committed
Fix crash when casting a string to byte*
1 parent beb6dd9 commit 666e61b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

slither/visitors/expression/constants_folding.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,8 @@ def _post_type_conversion(self, expression: expressions.TypeConversion) -> None:
450450
value = int.from_bytes(expr.value, "big")
451451
elif str(expression.type).startswith("byte") and isinstance(expr.value, int):
452452
value = int.to_bytes(expr.value, 32, "big")
453+
elif str(expression.type).startswith("byte") and isinstance(expr.value, str):
454+
value = expr.value
453455
else:
454456
value = convert_string_to_fraction(expr.converted_value)
455457
set_val(expression, value)

0 commit comments

Comments
 (0)