File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
src/ethereum/osaka/vm/precompiled_contracts Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 15
15
from ethereum_types .numeric import U256 , Uint
16
16
17
17
from ...vm import Evm
18
+ from ...vm .exceptions import ExceptionalHalt
18
19
from ...vm .gas import charge_gas
19
20
from ..memory import buffer_read
20
21
@@ -30,8 +31,16 @@ def modexp(evm: Evm) -> None:
30
31
31
32
# GAS
32
33
base_length = U256 .from_be_bytes (buffer_read (data , U256 (0 ), U256 (32 )))
34
+ if base_length > U256 (1024 ):
35
+ raise ExceptionalHalt ("Mod-exp base length is too large" )
36
+
33
37
exp_length = U256 .from_be_bytes (buffer_read (data , U256 (32 ), U256 (32 )))
38
+ if exp_length > U256 (1024 ):
39
+ raise ExceptionalHalt ("Mod-exp exponent length is too large" )
40
+
34
41
modulus_length = U256 .from_be_bytes (buffer_read (data , U256 (64 ), U256 (32 )))
42
+ if modulus_length > U256 (1024 ):
43
+ raise ExceptionalHalt ("Mod-exp modulus length is too large" )
35
44
36
45
exp_start = U256 (96 ) + base_length
37
46
You can’t perform that action at this time.
0 commit comments