-
Notifications
You must be signed in to change notification settings - Fork 709
Closed as not planned
Labels
bugSomething isn't workingSomething isn't workingreleases-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
The fetch method uses partition_point to find the corresponding merged range, but doesn't check if partition_point returns 0. When partition_point returns 0, 0 - 1 causes integer underflow (becomes usize::MAX), leading to out-of-bounds access and panic.
opendal/core/src/types/read/reader.rs
Line 179 in fc5725a
| let idx = merged_ranges.partition_point(|v| v.start <= range.start) - 1; |
Steps to Reproduce
none
Expected Behavior
Check if partition_point returns 0 before subtracting 1, and validate that each range is within the merged ranges.
Additional Context
No response
Are you willing to submit a PR to fix this bug?
- Yes, I would like to submit a PR.
dosubot
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingreleases-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