argotorg / argotorg/solidity

EVM assembly JSON import with multiple inputs triggers an ICE

Open
#16,834 0 comments 0 reactions 1 assignee Claimed by @cameel View on GitHub
bug :bug:
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
2d 19h
Merged PRs (30d)
29

Description

## Environment

- Compiler version: `0.8.36-develop.2026.6.25+commit.6deed02c` (argotorg/solidity `develop`, commit `6deed02c`, 2026-06-25)
- Built from source; Linux
- **Verified to reproduce on this commit.**

- Severity: LOW
- Module: solc
- Affected code: `solc/CommandLineParser.cpp`, `solc/CommandLineInterface.cpp`
- Repro: `repro_import_asm_json_stop.json`, `repro_import_asm_json_stop_second.json`

## Summary

The experimental `--import-asm-json` CLI mode is documented as accepting exactly
one input file, but command-line validation only checks that at least one input
source exists. If the user passes two assembly JSON files, the executor reaches
`assembleFromEVMAssemblyJSON()` and trips an internal assertion that the file
reader contains exactly one source unit.

This malformed CLI invocation therefore exits as an internal compiler error
instead of a command-line validation error.

## Root Cause

`CommandLineParser::parseInputPathsAndRemappings()` has a special exact-input
check for Standard JSON mode, but all other modes, including
`InputMode::EVMAssemblerJSON`, only require at least one input.

`CommandLineInterface::assembleFromEVMAssemblyJSON()` then assumes validation
has already enforced the single-input invariant and asserts that
`m_fileReader.sourceUnits().size() == 1`.

Relevant locations:

- `CommandLineParser.cpp`: exact input-count validation only exists for
Standard JSON mode; non-Standard modes only reject zero inputs.
- `CommandLineParser.cpp`: `--import-asm-json` selects
`InputMode::EVMAssemblerJSON`.
- `CommandLineInterface.cpp`: the execution path asserts that exactly one
source unit was loaded.

## Reproduction

Run:

```bash
solc --experimental --import-asm-json --bin \
repro_import_asm_json_stop.json \
repro_import_asm_json_stop_second.json
```

Observed result:

```text
Internal compiler error:
/solidity/solc/CommandLineInterface.cpp(901): Throw in function void solidity::frontend::CommandLineInterface::assembleFromEVMAssemblyJSON()
std::exception::what: Solidity assertion failed
```

## Impact

This is limited to the experimental assembly import CLI mode and requires an
invalid command-line invocation. The parser should reject multiple inputs, or a
file-plus-stdin combination, for `--import-asm-json` before execution reaches
the internal invariant.

## Steps to reproduce

Save the source(s) below, then run:

```bash
solc --experimental --import-asm-json --bin \
repro_import_asm_json_stop.json repro_import_asm_json_stop_second.json
```

`repro_import_asm_json_stop.json`:

```json
{
".code": [
{
"name": "STOP"
}
]
}
```

`repro_import_asm_json_stop_second.json`:

```json
{
".code": [
{
"name": "STOP"
}
]
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.