sqlmapproject/sqlmap · error · OverflowError

integer magnitude exceeds representable range

Error message

integer magnitude exceeds representable range (+/-%d), direction unknown

What it means

extractInteger magnitude failure: bracketing could not bound the value within +/-cap in either direction (both the positive and negative exponential brackets ran away), so the integer exceeds the representable range and even its sign is unknown.

Solutions

  1. Increase the cap/HUGE ceiling if the dialect supports bigger integers
  2. Fall back to string extraction of the numeric literal
  3. Report the column as out-of-range for blind integer extraction
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at extra/esperanto/extraction.py:657 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sqlmapproject/sqlmap@0a35b20e39 (2026-08-26). Data as JSON: /api/errors/0713a68ad028951d. Report an issue: GitHub.

Appendix: source

Thrown at extra/esperanto/extraction.py:657

                raise OverflowError("integer exceeds maximum %d" % ceil)
        # ordered comparator: bracket the value with `expr > n` probes then bisect the
        # transition. The `high` arg to _gtNum MUST exceed any possible value (BETWEEN renders
        # `expr BETWEEN n+1 AND high`; using `cap` there made every over-cap positive read as
        # an empty range -> misclassified NEGATIVE, reporting "below minimum" for an above-max
        # value). Use HUGE as the range ceiling everywhere; `cap` is only the overflow threshold.
        HUGE = 1 << 62
        if self._gtNum(expr, -1, HUGE):                 # expr > -1  <=>  expr >= 0 (any magnitude)
            if self._gtNum(expr, cap, HUGE):            # expr > cap  -> ABOVE maximum
                raise OverflowError("integer exceeds maximum %d" % cap)
            lo, hi = -1, 1
            while hi < cap and self._gtNum(expr, hi, HUGE):
                lo, hi = hi, min(hi * 2 + 1, cap)
        else:                                           # not in [0, HUGE]
            # BETWEEN's sign test caps at HUGE, so a positive value ABOVE HUGE also lands here.
            # distinguish it from a genuine negative before reporting a direction (a gt/operator-
            # free sign test is unbounded, so its else-branch is truly negative and skips this).
            if self._comparator == "between" and not self._ask("(%s) BETWEEN %d AND %d" % (expr, -HUGE, -1)):
                raise OverflowError("integer magnitude exceeds representable range (+/-%d), direction unknown" % HUGE)
            if not self._gtNum(expr, -cap - 1, HUGE):   # expr <= -cap-1 -> BELOW minimum
                raise OverflowError("integer below minimum -%d" % cap)
            hi, lo = -1, -2
            while lo > -cap and not self._gtNum(expr, lo, HUGE):
                hi, lo = lo, lo * 2
            lo = max(lo, -cap - 1)
        # invariant: expr > lo is True, expr > hi is False -> value is the transition in (lo, hi]
        while hi - lo > 1:
            mid = (lo + hi) // 2
            if self._gtNum(expr, mid, HUGE):
                lo = mid
            else:
                hi = mid
        # FINAL INDEPENDENT CHECK: bisection trusts the comparator, which is only PROVEN on
        # integer literals - a backend/WAF that honours '>' on literals but rewrites it (e.g. to
        # '>=') for scalar-subquery / fn / arithmetic operands would converge off-by-one. Confirm
        # the result with a direct equality against the ACTUAL expression; if it isn't decisively
        # true the read is invalid -> fail closed (never return a silently-wrong count/length/id).

View on GitHub (pinned to 0a35b20e39)