TL;DR
- Gemini 4 Argon translates Go assembly into Z3 constraint solver rules to hunt for bounds-check panics that fuzzing misses
- The approach processes assembly disassembly and source code to model paths to runtime.panicBounds traps, finding concrete reproducer inputs when constraints are satisfiable
- Go's fuzzer missed crashes because it often provides spare buffer capacity, allowing out-of-bounds slices to succeed; clipping capacity to length in fuzz tests fixes this blind spot
- Testing on skill-lint, a Go CLI linter, found three latent bugs in pure functions extracted from file-reading code
- Runtime per function
- About 1 minute (Argon
- Constraint solver
- Z3 (finishes in milliseconds)
- Go version tested
- Go 1.27.3
What happened
Google released a workflow combining Gemini 4 Argon and the Z3 constraint solver to find bounds-check bugs in Go code that traditional fuzzing misses. Karl Weinmeister, Director of Developer Relations at Google, developed the approach while maintaining skill-lint, a Go CLI that checks SKILL.md files. Even with unit and fuzz tests, subtle slice or index mistakes in its Markdown parsers can lurk until an unusual input triggers a runtime panic. The solver-based method caught all three intentionally planted bugs in test parsers and discovered three previously latent bugs in skill-lint itself.
How the pipeline works
Go's compiler automatically inserts bounds-check traps (runtime.panicBounds calls) for slice and index operations it cannot prove safe at compile time. The SSA prove optimization pass already eliminates most of these checks by tracking slice lengths and loop variables, leaving only the traps the compiler could not rule out. This creates a short list of candidate crash sites. Weinmeister compiled target functions with RISC-V architecture (GOOS=linux GOARCH=riscv64 go build -gcflags="-S -d=ssa/check_bce/debug=1"), which produced both assembly listings and logs of surviving bounds checks. He then passed the Go source code and disassembly to Gemini 4 Argon, which generated a Z3 script modeling the path to each surviving trap. Z3 checked whether the modeled constraints could be satisfied; when it found a crashing input, go test replayed those bytes against the actual function to confirm the bug. Argon's translation dominated runtime at roughly one minute per function, while Z3 itself completed in milliseconds. The RISC-V target was chosen because it matches the instruction set used in related formal verification work and because Go cross-compiles to it directly.
GOOS=linux GOARCH=riscv64 go build -gcflags="-S -d=ssa/check_bce/debug=1"Why fuzzing missed two crashes
Go's slice bounds check validates against the slice's capacity, not its length. However, Go's fuzzer typically provides slices with significant spare capacity. In a ten-second probe of over 386,000 fuzz calls, 89 percent of inputs were views into a shared ~100 MB buffer, and only 0.07 percent had capacity equal to length. With such spare capacity, an out-of-bounds slice index can silently succeed by slicing into unused memory instead of panicking. Both ParseTwoChunkFrame and ExtractQuotedToken exhibited this pattern: Z3 caught them immediately (with a 59-byte input and a 2-byte input respectively), but the fuzzer absorbed the overruns in spare capacity. The third planted bug, ParseMagicPacket, involved a signed int8 length that panics on a negative index regardless of capacity, so the fuzzer found it reliably. A simple fix applies a full slice expression to clip capacity to length, forcing any slice past the end to panic. After this change, the fuzzer caught both overrun bugs in all three runs with median times of 0.28 and 0.17 seconds respectively.
data = data[:len(data):len(data)] // cap == len: slicing past the end now panicsSoundness and practical limits
Unlike formal verification systems that prove correctness, Gemini and Z3 trade away complete mathematical soundness for practical speed. A sat answer ("definitely buggy") delivers concrete bytes targeting the crash, and go test verifies the bug by running those bytes against the real function. Once go test panics, a concrete bug reproducer exists regardless of whether Argon's model is sound. An unsat answer only means "maybe correct," similar to a Bloom filter. This approach provides most of the bug-finding value of formal methods for a fraction of the effort. Weinmeister checked individual functions on fresh 64-byte slices where capacity equals length, whereas formal verification work targets whole binaries under larger memory budgets.
Results on skill-lint
Testing the pipeline on skill-lint itself required extracting pure functions because a 10-line parser links 1,559 symbols from the Go runtime and the full 28 MB skill-lint binary contains 32,321 symbols total. Following the Functional Core, Imperative Shell pattern, Weinmeister left CLI flags, network calls, and file I/O to standard fuzzing and race detection, and ran the solver only on pure functions and slice helpers extracted from file-reading code. Of five functions tested, two scanners returned unsat (including a CRLF line splitter with six surviving bounds checks), and the other three contained bugs. The approach complements rather than replaces standard tooling: go test -fuzz and go test -race handle file I/O, CLI flags, and concurrency, while the solver focuses on slice math and parsing logic.
Source
Google Developers Bloghttps://developers.googleblog.com/catch-go-bugs-that-fuzzing-misses-with-gemini-and-a-constraint-solver/AI-assisted, verified against the source. This post was drafted with AI from the primary source linked above and checked automatically against it. For anything you depend on, read the original.
- #go
- #fuzzing
- #staticanalysis
- #constraintsolving
- #bugdetection
