Memory leak for certain bytecode
- Dominant language
- C++
- Stars
- 169
- Forks
- 78
- PR merge metrics
- No merged PRs in 30d
Description
The following byte code triggers a memory leak:
```c
0x60, 0x60, 0x60, 0x53, 0x53
```
I'm currently using this code to run the EVM:
```cpp
1 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
2 {
3 struct evm_instance* instance = evmjit_create();
4 if (EVM_ABI_VERSION != instance->abi_version)
5 {
6 return 1;
7 }
8 struct evm_uint256be code_hash;
9 memset(&code_hash, 0, sizeof(code_hash));
10 MD5(data, size, (unsigned char*)&code_hash);
11 uint8_t const input[] = "Hello World!";
12 struct evm_uint256be value = {{1, 0,}};
13 struct evm_address addr = {{0, 1, 2,}};
14 int64_t gas = 2000;
15 struct evm_message msg = {addr, addr, value, input, 0,
16 code_hash, gas, 0};
17 struct evm_context ctx = {&ctx_fn_table};
18 struct evm_result result =
19 instance->execute(instance, &ctx, EVM_HOMESTEAD, &msg, data, size);
20 return 0;
21 }
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the report with the bytecode sequence 0x60, 0x60, 0x60, 0x53, 0x53 using the shown LLVMFuzzerTestOneInput harness. Trace the lifecycle around evmjit_create() and instance->execute(); done means the input no longer produces a memory leak.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100