aleth icon indicating copy to clipboard operation
aleth copied to clipboard

The process aleth-vm throws an OutofMemoryError when it detect an "infinite loop"

Open BattleBird opened this issue 5 years ago • 3 comments

aleth version: 1.8.0 Operating system: Linux Installation: built from source

when I use the binary aleth-vm to run the following code, the following bytecode contains an "infinite loop", it will not print trace information and terminate the operation correctly until the gas limit is used up. ./aleth-vm_1.8.0 stats --code 608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063f8a8fd6d146044575b600080fd5b348015604f57600080fd5b506056606c565b6040518082815260200191505060405180910390f35b600080600190505b600581101560745760005481600054020160008190555080806001019150506074565b600054915050905600a165627a7a7230582010c05846ebb8bfc4e2e4c1d67c00000000000000008ae603dce419deaac37d13cb56c3c43a1bc2950029 --mnemonics --input f8a8fd6d The corresponding control flow graph is as follow, we can observe an infinite loop in block 0x74 abnormal_memory_TestLoop The corresponding set of opcode sequences is as follow, opcode_sequences

However, when I use the binary aleth-vm to run the following code, the following bytecode also contains an "infinite loop", it will continue to occupy CPU resources until the system kills the whole process. In addition, aleth throws OutOfMemoryError when it crashes.

./aleth-vm_1.8.0 stats --code 608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063f8a8fd6d146044575b600080fd5b348015604f57600080fd5b506056606c565b6040518082815260200191505060405180910390f35b600080600190505b6005811015604f5760005481600054020160008190555080806001019150506074575b600054915050905600a165627a7a7230582010c05846ebb8bfc4e2e4c1d67c00000000000000008ae603dce419deaac37d13cb56c3c43a1bc2950029 --mnemonics --input f8a8fd6d The corresponding control flow graph is as follow, we can observe an infinite loop in blocks 0x4f, 0x6c, 0x74. abnormal_storage_TestLoop The corresponding opcode sequences is as follow, storage_opcode_sequences

We provide enough gas limit when run two piece of bytecode both contain an infinite loop, but aleth run normally for one and throws OutOfMemoryErrors for another one. This corner cases may expose a bug in aleth's EVM implementation.

BattleBird avatar Jun 15 '20 12:06 BattleBird

Hello. Nice to meet you. I would like to work on this issue.

pepo939393 avatar Oct 12 '20 13:10 pepo939393

Hello. Nice to meet you. I would like to work on this issue.

Fine. Please keep track of the progress and keep in touch with me. Thanks very much:)

BattleBird avatar Oct 13 '20 04:10 BattleBird

Thank you too :) I will inform you about my progress in the short time.

pepo939393 avatar Oct 13 '20 05:10 pepo939393