argotorg / argotorg/solidity

ICE in ArrayType::calldataEncodedSize(bool) [Array size does not fit unsigned]

Open
#8,382 10 comments 0 reactions 0 assignees View on GitHub
bug :bug: low impact medium effort nice to have should report better error
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
21

Description

## Description

This contract:
```solidity
contract C {
struct R { uint[10][10] y; }
struct S { uint a; uint b; R d; uint[20][20][2999999999999999999999999990] c; }
function f() public {
C.S memory y;
C.S[10] memory z; y.a < 2;
}
}
```

produces:

```
Internal compiler error during compilation:
/home/user/solidity/libsolidity/ast/Types.cpp(1662): Throw in function virtual unsigned int solidity::frontend::ArrayType::calldataEncodedSize(bool) const
Dynamic exception type: boost::exception_detail::clone_impl
std::exception::what: Array size does not fit unsigned.
[solidity::util::tag_comment*] = Array size does not fit unsigned.
```

when compiled with solc

On master, using AFL fuzzing. Another discovery using https://github.com/agroce/afl-compiler-fuzzer, now with a few more mutation operators

## Environment

- Compiler version: 0.6.3-develop.2020.2.10+commit.e8eb1f2d.Linux.clang
- Target EVM version (as per compiler settings): N/A
- Framework/IDE (e.g. Truffle or Remix): N/A
- EVM execution environment / backend / blockchain client: N/A
- Operating system: Ubuntu 18.04 in docker

## Steps to Reproduce

Above shows pretty clearly, I think.

Contributor guide

Open the contributing guide

Research direction

Reproduce the contract with solc, then inspect libsolidity/ast/Types.cpp around line 1662 and ArrayType::calldataEncodedSize(bool), where the reported ICE is thrown. Done means this input no longer produces the reported InternalCompilerError.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, solidity
Domain
blockchain, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.