Proof Portal

Projects

jsonparser

ProbeLabs36 findings · 123 requirements
Back to findings
Known issueKI-7

parseInt fast-path threshold off-by-one — 19-digit integers skip overflow check and wrap silently

OpenOpenHigh

High-severity issue, currently open.

Introduced

When and where this issue first entered the codebase — the commit it traces back to.

Inception (latent from the first version)

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.

Applications that trust ParseInt/GetInt can silently receive a wrong (wrapped) integer for a large 19-digit value with no error signalled — corrupting balances, quotas, IDs, or limits derived from that number. Intentional demo defect on the proof-demo showcase branch; never shipped.

Reachability

Reachable via ParseInt/GetInt on attacker-controlled numeric JSON; triggered only by integers of exactly 19 digits that exceed math.MaxInt64, so it is silent and easy to miss.

Technical description

parseInt (bytes.go) has an unchecked fast path for short digit runs and an overflow-checked slow path for long ones, gated by a digit-count threshold. On the proof-demo showcase branch that threshold was moved from `if l-i < 19` to `if l-i < 20` (bytes.go:27), so a 19-digit value now takes the unchecked fast path and is accumulated with plain int64 arithmetic that wraps around on overflow instead of routing through the overflow-checked slow path. This is a CWE-190 Integer Overflow (with a downstream CWE-704 Incorrect Type Conversion): a 19-digit literal above math.MaxInt64 returns a silently wrapped, wrong int64 with a nil error rather than OverflowIntegerError. Intentional demo defect on the proof-demo showcase branch; never shipped.

Severity, explained

Why this is rated the way it is — and the scoring signals behind the rating (each ⓘ explains the term).

HighRated severity — the impact if this issue is exploited or hit.
why this rating
Risk-rated
risk area
Data Integrity
Security classification
Security-relevant
CVSS
CVSS 7.5· Highv3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
CVE surface
Unlikely

Where it is

The code the issue lives in — peek the affected function inline to see it in context.

  • parseInt

How it's proven

The reproducer — an actual test that drives the real code and shows the issue happening. Run it yourself, or peek the test and the source it covers.

Known issue reproducedprovesSYS-REQ-039
Run it yourself
go test -run TestDemoKI7 -count=1 .
Covers (3)
Last run Aug 3, 2026, 11:00 AM

Reproduction steps

Technical steps for your engineers to confirm the issue by hand.

  1. Check out the proof-demo showcase branch and build the package.
  2. Call jsonparser.GetInt on a document whose value is 9999999999999999999 — or run: go test -run TestDemoKI7 -count=1 .
  3. Observe a silently wrapped negative int64 with a nil error instead of OverflowIntegerError.
  4. Revert bytes.go:27 to `if l-i < 19` and re-run; the reproducer now returns the overflow error.
go test -run TestDemoKI7 -count=1 .
go test ./... -count=1

How it can be triggered

The input or condition that sets this issue off.

a 19-digit integer literal exceeding int64, e.g. 9999999999999999999

What protects you, and the fix

What limits your exposure today, and the planned remediation.

What protects you now

Validate numeric magnitude/length before trusting ParseInt output, or parse large integers as strings and range-check them, until the fast-path threshold is restored.

The fix

Restore the 19-digit fast-path threshold in parseInt (bytes.go:27, `if l-i < 20` -> `if l-i < 19`) so any integer of 19-or-more digits is routed through the overflow-checked path and returns OverflowIntegerError for out-of-range input. Closes CWE-190 Integer Overflow / CWE-704 Incorrect Type Conversion.

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.

Tracing blast radius…

Touch this finding and you re-check 4 requirements · 2 code files · 9 tests.

Code files (2)
  • parser.go
  • fuzz.go
Tests (9)
  • mcdc_spec_witnesses_test.go
  • obligation_evidence_test.go
  • parser_test.go
  • deep_spec_test.go
  • bytes_test.go
  • fuzz_native_test.go
  • mcdc_supplement_test.go
  • property_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.

Implementing code (1)
  • parser.go
    ParseInt
Tests & evidence (4)
  • README.md
  • mcdc_spec_witnesses_test.go
  • obligation_evidence_test.go
  • parser_test.go
Proof obligations (1)
boundary

Behavior at limits, thresholds, and edge-of-range values.

  • nominal (required)obligation_evidence_test.go:363
Implementing code (1)
  • parser.go
    GetInt
Tests & evidence (4)
  • README.md
  • deep_spec_test.go
  • mcdc_spec_witnesses_test.go
  • obligation_evidence_test.go
Proof obligations (2)
boundary

Behavior at limits, thresholds, and edge-of-range values.

  • nominal (required)obligation_evidence_test.go:559
edge_case

Behavior for unusual but valid input combinations.

  • nominal (required)obligation_evidence_test.go:560
Implementing code (2)
  • fuzz.go
    FuzzParseInt
  • parser.go
    ParseInt
Tests & evidence (9)
  • README.md
  • 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
Proof obligations (3)
edge_case

Behavior for unusual but valid input combinations.

  • nominal (required)obligation_evidence_test.go:205
malformed_input

Behavior when inputs are syntactically or structurally invalid.

  • negative (required)parser_test.go:2374
  • nominal (required)parser_test.go:2370
nil_safety

Behavior specified when inputs are nil, null, or zero-value.

  • negative (required)obligation_evidence_test.go:207
  • nominal (required)obligation_evidence_test.go:206
Implementing code (1)
  • parser.go
    ParseInt
Tests & evidence (3)
  • README.md
  • deep_spec_test.go
  • mcdc_spec_witnesses_test.go

Evidence trail

The raw evidence manifests behind this finding — superseded by the resolved reproducer above, kept here for traceability.

  • proof/evidence/KI-7-reproducer.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.

Sign in to discuss this with the proof team.Sign in