-
Notifications
You must be signed in to change notification settings - Fork 730
bug: range with end larger than start leads to underflow #7337
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't workingcorereleases-note/fixThe PR fixes a bug or has a title that begins with "fix"The PR fixes a bug or has a title that begins with "fix"rustPull requests that update Rust codePull requests that update Rust code
Description
Describe the bug
Hi team, we have a few range concepts in the codebase (ex, ex), which implicitly requires end offset is no less than start offset, but I don't think we check it.
As a result, we could potentially suffer underflow in certain places
Some(end - start + 1) Ok(BytesRange::new(start, Some(end - start + 1))) - and a few others
Steps to Reproduce
N/A
Expected Behavior
we check the input requirement at construction and propagate the error / panic as early as possible
Additional Context
No response
Are you willing to submit a PR to fix this bug?
- Yes, I would like to submit a PR.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcorereleases-note/fixThe PR fixes a bug or has a title that begins with "fix"The PR fixes a bug or has a title that begins with "fix"rustPull requests that update Rust codePull requests that update Rust code