Skip to content

reject out-of-range values in range and content-range parsers#1012

Merged
markt-asf merged 1 commit into
apache:mainfrom
sahvx655-wq:range-parser-long-overflow
May 27, 2026
Merged

reject out-of-range values in range and content-range parsers#1012
markt-asf merged 1 commit into
apache:mainfrom
sahvx655-wq:range-parser-long-overflow

Conversation

@sahvx655-wq
Copy link
Copy Markdown
Contributor

Ranges.parse and ContentRange.parse are documented to return null for any value they can't accept, but a numeric field larger than Long.MAX_VALUE (e.g. Range: bytes=0-99999999999999999999) lets a NumberFormatException escape readLong. In DefaultServlet that turns the usual 416/400 for a bad range into a 500. Catch it where the longs are read and return null, like every other malformed range.

A numeric field larger than Long.MAX_VALUE let a NumberFormatException escape readLong instead of the documented null return, turning a malformed range into a 500 in DefaultServlet.
@markt-asf markt-asf merged commit bb4220a into apache:main May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants