solang icon indicating copy to clipboard operation
solang copied to clipboard

soroban-emit-multifuzz-v2 — Soroban emit-pass fuzzing campaign: 19 compiler crashes

Open ahmadsamehh opened this issue 3 months ago • 0 comments

Summary

This is a tracking issue for 19 distinct crashes found in Solang's Soroban (Stellar) codegen/emit pass, discovered via an AFL++ fuzzing campaign (soroban-emit-multifuzz-v2) using a tree-sitter grammar-aware Solidity mutator, plus a follow-up run of the official ethereum/solidity test suite through solang compile --target soroban. All crashes below are confirmed reproducible on the public solang v0.3.5 CLI unless noted otherwise.

Each crash is filed as its own linked sub-issue with a minimal repro, crash output, backtrace, and root-cause analysis. This parent issue exists to give maintainers a single place to see the shape and scale of the findings before triaging individually. All 19 sub-issues are now filed; see the table below.

Methodology

Fuzzer: AFL++ (4 workers: 1 master + 3 slaves), custom solang_source_fuzzer harness built with --features afl,emit, tree-sitter grammar-aware mutator.

Reproduction: all crashes re-confirmed independently against the public solang v0.3.5 release binary (solang compile --target soroban file), not just the internal fuzzing harness.

Backtraces: RUST_BACKTRACE=full for ordinary Rust panics; gdb --batch -ex run -ex bt for signal-based crashes (SIGSEGV/SIGABRT) that don't produce Rust panic text.

Minimization: every repro is hand-minimized from the original fuzzer-found input to the smallest reproducing case.

Sub-issues

Item Title Crash type Issue
1 Chained compound multiplication on a parameter-derived value crashes strength_reduce range N..M out of bounds panic #2000 (may overlap with pre-existing #1910)
2 Function/parameter names exceeding Soroban's 32-byte spec limit crash instead of erroring panic!()/.expect() #2001
3 Array literal mixing integer and decimal-derived bitwise-AND crashes constant_folding unreachable!() #2002
4 Unary ~ on a void-returning external/interface call crashes the compiler assert_eq! failure #2003
5 Bare return; in a non-void function crashes the LLVM inliner SIGABRT/SIGSEGV (invalid LLVM IR) #2004
6 Chained call on a void-returning builtin bypasses "not callable" check assert_eq! failure #2005
7 Overly long contract name crashes the linker instead of producing a diagnostic .unwrap() panic (2 sites) #2006
8 Declaring two overloaded constructors crashes Soroban codegen missing-LLVM-entity panic #2007
9 Function with more than 10 parameters crashes Soroban XDR spec generation .unwrap() on LengthExceedsMax #2008
10 extendTtl() on a state var with no explicit storage annotation crashes .expect() failure #2009
11 extendTtl() on instance storage crashes via panic!() instead of a clean diagnostic panic!() #2010
12 Rational/decimal literal as a ternary condition crashes emit unreachable!() #2011
13 Non-boolean variable as a ternary condition crashes LLVM directly LLVM BranchInst::AssertOK assertion #2012
14 Array method called directly on an index expression into a 2D array crashes not an array panic #2013
15 extendTtl() crashes if either argument is a variable instead of a literal Expected ... NumberLiteral panic #2014
16 Void-returning call as a ternary condition crashes constant folding Poison panic #2015
17 Void expression as an argument to authAsCurrContract crashes internal encoding unreachable!() (no type) #2016
18 authAsCurrContract has no argument-count or argument-type validation index-out-of-bounds / unreachable!() #2017
19 State var + 2 functions + array push/index crashes emit, only with a 2nd contract in file index-out-of-bounds panic #2018

Note: two additional bugs from the same campaign are not included as sub-issues here. One was already fixed upstream in v0.3.5 via PR #1927. One was an earlier, narrower repro superseded by sub-issue 5's (#2004) more general minimal case.

Thematic clusters worth fixing together

A few of these share a root design gap and might be worth addressing as a group rather than one-off patches.

Sub-issues 9, 15, and 18 (#2008, #2014, #2017) all involve Soroban builtins (extendTtl, authAsCurrContract) that assume literal/fixed-shape arguments with no semantic-analysis validation, so anything else crashes deep in emit/codegen.

Sub-issues 12, 13, and 16 (#2011, #2012, #2015) are three separate holes in the same "ternary condition must be boolean" check, each triggered by a different non-boolean shape (rational literal, non-literal variable, void call).

Sub-issues 6 and 17 (#2005, #2016) both involve void-returning expressions used somewhere a value is expected, slipping past validation that already works correctly for ordinary user-defined functions in the same position.

How to help

Each sub-issue is self-contained with a minimal .sol repro, exact crash output, and full backtrace — should be directly runnable against solang compile --target soroban file to confirm.

ahmadsamehh avatar Aug 20 '26 10:08 ahmadsamehh