# Missing range check on field or curve point

Inputs, curve points, or encoded values accepted without width or range validation, causing reverts or corruption

_Area: Smart contract access control and control flow. Seen in 2 disclosed reports; one confirmed bounty: $10,000; latest 2024-03-14. Updated 2026-10-23._

## How it works
A value is accepted because the code checks one property but not its numeric bounds. A curve point passes the on-curve equation but its coordinates exceed the field modulus; a terminator comparison passes because the compared length is zero; a scheduling formula is trusted to stay in the past. The broken assumption is that "valid shape" implies "valid range." Downstream code (a precompile, a parser state machine, a subtraction) then enforces the bound the caller skipped, and reverts or loops instead of failing cleanly at the boundary.

## Where it shows up
- Curve-point validators that check the curve equation and exclude generator/infinity but never compare coordinates against FIELD_MODULUS [E2](https://bugbountylibrary.com/r/sherlock%3A2024-03-axis-finance%3AH-8.md).
- Length- or width-based comparisons (strncmp/memcmp, slice bounds) where a zero or empty length makes the check always succeed [E1](https://bugbountylibrary.com/r/h1%3A187305.md).
- Emulation layers reimplementing an opcode or spec where edge cases (empty accounts, precompile ranges) are decided by address or code alone, ignoring balance/nonce [E3](https://bugbountylibrary.com/r/c4%3A2023-10-zksync%3AM-19.md).
- Scheduling or index math that multiplies a per-phase constant by cumulative supply, so a later phase computes a timestamp past block.timestamp [E4](https://bugbountylibrary.com/r/c4%3A2023-10-nextgen%3AH-04.md).

## How to review
For every externally supplied field, point, or encoded value, find the exact bound the consumer enforces and confirm the validator enforces the same bound before storage or use. The invariant: any value that passes validation must be accepted by every downstream consumer (precompile, subtraction, parser) without revert. Check zero-length and empty inputs explicitly; a comparison with length 0 must be guarded, not relied on. Diff emulated behavior against the spec line by line [E3](https://bugbountylibrary.com/r/c4%3A2023-10-zksync%3AM-19.md). For time/supply formulas, verify state that should reset per phase actually resets [E4](https://bugbountylibrary.com/r/c4%3A2023-10-nextgen%3AH-04.md).

## Variants seen
- Missing field-modulus bound on AltBn128 points, causing ecMul precompile revert and permanent DoS of auction decryption [E2](https://bugbountylibrary.com/r/sherlock%3A2024-03-axis-finance%3AH-8.md).
- Zero-length heredoc identifier making strncmp match empty, looping the parser and ignoring SIGTERM [E1](https://bugbountylibrary.com/r/h1%3A187305.md).
- Opcode emulation diverging from EIP-1052 on empty-account and precompile edge cases [E3](https://bugbountylibrary.com/r/c4%3A2023-10-zksync%3AM-19.md).
- Cumulative-supply time multiplier pushing lastMintDate past block.timestamp, underflowing and bricking mints [E4](https://bugbountylibrary.com/r/c4%3A2023-10-nextgen%3AH-04.md).

## Impact and severity
Ranged from permanent denial of service of a core protocol function (auction decryption [E2](https://bugbountylibrary.com/r/sherlock%3A2024-03-axis-finance%3AH-8.md), minting [E4](https://bugbountylibrary.com/r/c4%3A2023-10-nextgen%3AH-04.md)) to sandbox escape-resistance failure via an unkillable loop [E1](https://bugbountylibrary.com/r/h1%3A187305.md) and consensus-relevant opcode divergence [E3](https://bugbountylibrary.com/r/c4%3A2023-10-zksync%3AM-19.md). Severity rises when the bad value is persisted or when the failure is unrecoverable; a single unvalidated input that bricks a shared path is high impact.

## Why fixes fail
Validating shape (on-curve, non-empty-looking) without validating range leaves the consumer to revert; the check must mirror the consumer's bound exactly, not approximate it [E2](https://bugbountylibrary.com/r/sherlock%3A2024-03-axis-finance%3AH-8.md).

## Evidence
- E1: https://bugbountylibrary.com/r/h1%3A187305.md
- E2: https://bugbountylibrary.com/r/sherlock%3A2024-03-axis-finance%3AH-8.md
- E3: https://bugbountylibrary.com/r/c4%3A2023-10-zksync%3AM-19.md
- E4: https://bugbountylibrary.com/r/c4%3A2023-10-nextgen%3AH-04.md
