argotorg / argotorg/solidity

Large StandardCompiler (AST JSON) output cannot be parsed by jsoncpp

Open
#5,898 9 comments 0 reactions 0 assignees View on GitHub
bug :bug: low impact medium effort should compile without error
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
21

Description

Found by ossfuzz (12705).

```
contract C { function f() public pure { ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(1);
}
}
```

The negation operator results in a large nested object in the AST JSON output, which makes jsoncpp to run out of stack depth parsing:
```
libc++abi.dylib: terminating with uncaught exception of type Json::RuntimeError: Exceeded stackLimit in readValue().
Abort trap: 6
```

This happens in solfuzz only where the compilation output is parsed into JSON.

Contributor guide

Open the contributing guide

Research direction

Start in solfuzz where compilation output is parsed into JSON, and reproduce the provided contract with the long negation expression. Trace the AST JSON handling with jsoncpp and verify that this input no longer fails with the Exceeded stackLimit error.

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
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.