googleapis / googleapis/google-cloud-rust
Inverted split_off logic in IterSource::seek corrupts resumed unbuffered upload
- Dominant language
- Rust
- Stars
- 955
- Forks
- 144
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 279
Description
Unconfirmed. This is the result of a search with Claude, may be a false positive.
`IterSource` backs `Payload::from(Vec)` during unbuffered and streaming uploads. On partial resume, `seek(offset)` is intended to keep the unpersisted suffix `[o, n)` of the buffer element containing the offset.
However, in `src/storage/src/storage/streaming_source.rs`:
https://github.com/googleapis/google-cloud-rust/blob/f02b42c2ac5720334cd2b5335824bd4166264527/src/storage/src/storage/streaming_source.rs#L313-L316
The code executes `b.clone().split_off(n - o)`, which retains the last `o` bytes instead of the tail `n - o` bytes. This leads to the same data corruption on resumed unbuffered uploads as seen in the buffered upload path.
Contributor guide
Research direction
Start in src/storage/src/storage/streaming_source.rs at IterSource::seek, especially lines 313-316, and trace how the offset and buffer lengths determine the unpersisted suffix. Confirm the behavior against resumed unbuffered uploads; done means the suffix after the resume offset is preserved without corrupting the upload.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100