Proof Portal
jsonparser
ProbeLabs36 findings · 123 requirementsParseInt("-") returns (0, nil) — silent false-success on sign-only input
This defect has been fixed and verified.
Introduced
When and where this issue first entered the codebase — the commit it traces back to.
Affected requirements
The requirement(s) this issue violates — click through to the spec.
What this means for you
Plain-language impact — what this issue could mean for your users and your system, before any of the technical detail.
parseInt (bytes.go:9) strips a leading sign byte and then iterates over the remainder. When the input is exactly the sign byte (`-`), the remainder is empty, the loop runs zero iterations, n stays 0, and the function returns (0, true, false). The public ParseInt therefore reports a successful parse of value 0 for an input that is structurally a malformed JSON number (sign with no digits).
Severity, explained
Why this is rated the way it is — and the scoring signals behind the rating (each ⓘ explains the term).
- why this rating
- Risk-rated
- risk area
- Correctness
- CVE surface
- None
Where it is
The code the issue lives in — peek the affected function inline to see it in context.
- ParseInt, GetInt
Reproduction steps
Technical steps for your engineers to confirm the issue by hand.
go run -trimpath -e - <<EOF
package main
import (
"fmt"
"github.com/buger/jsonparser"
)
func main() {
v, err := jsonparser.ParseInt([]byte("-"))
fmt.Printf("v=%d err=%v\n", v, err)
}
EOF
go test -run TestParseInt ./...How it can be triggered
The input or condition that sets this issue off.
caller-supplied Number ValueType byte slice (already tokenized out of the JSON stream)
What protects you, and the fix
What limits your exposure today, and the planned remediation.
What protects you now
No mitigation required for live input: parseInt is only reachable via a JSON Number ValueType already validated by the tokenizer, and the JSON grammar never emits a standalone `-` token. The bug is reachable only via direct caller misuse of the exported ParseInt.
The fix
One-line guard in parseInt (bytes.go): after stripping the sign byte, return (0, false, false) when len(bytes) == 0 so the caller surfaces MalformedValueError. Add a TestParseInt row covering ParseInt("-").
Blast radius
If you touch this issue, what else may need re-checking — the requirements it affects and the code and tests that hang off them.
Touch this finding and you re-check 4 requirements · 2 code files · 9 tests.
- fuzz.go
- parser.go
- bytes_test.go
- fuzz_native_test.go
- mcdc_spec_witnesses_test.go
- mcdc_supplement_test.go
- obligation_evidence_test.go
- parser_test.go
- property_test.go
- reference_oracle_test.go
- and 1 more
Per-requirement evidence
For each requirement this finding touches: the implementing code, verifying tests, and proof obligations that discharge it.
Per-requirement evidence
For each requirement this finding touches: the implementing code, verifying tests, and proof obligations that discharge it.
Evidence trail
The raw evidence manifests behind this finding — superseded by the resolved reproducer above, kept here for traceability.
Evidence trail
The raw evidence manifests behind this finding — superseded by the resolved reproducer above, kept here for traceability.
- proof/evidence/ki2-parseint-sign-only.yaml
Discussions
Discuss this with the proof team. Nothing changes in your audit automatically — you open a request and a staff member records any outcome inside the thread.