fixing exponent dos by adding limits on size of exponent

pull/608/head
Claudia Richoux 4 years ago
parent eb9c01cc27
commit 246a4baa0e
  1. 10
      slither/slithir/variables/constant.py

@ -27,10 +27,16 @@ class Constant(SlithIRVariable):
else:
if 'e' in val:
base, expo = val.split('e')
self._val = int(Decimal(base) * (10 ** int(expo)))
expo = int(expo)
if expo > 80:
raise ValueError("exponent is too large to fit in any Solidity integer size")
self._val = int(Decimal(base) * (10 ** expo))
elif 'E' in val:
base, expo = val.split('E')
self._val = int(Decimal(base) * (10 ** int(expo)))
expo = int(expo)
if expo > 80:
raise ValueError("exponent is too large to fit in any Solidity integer size")
self._val = int(Decimal(base) * (10 ** expo))
else:
self._val = int(Decimal(val))
elif type.type == 'bool':

Loading…
Cancel
Save