googleapis / googleapis/google-cloud-rust
Partial-resume skips the wrong bytes in the buffered uploader
- 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.
After a 308 Resume Incomplete response with `persisted_size` strictly inside the current chunk, `handle_partial` must drop the first `s` already-persisted bytes of a `Bytes` element of length `n`.
However, in `src/storage/src/storage/perform_upload/buffered/progress.rs`:
https://github.com/googleapis/google-cloud-rust/blob/f02b42c2ac5720334cd2b5335824bd4166264527/src/storage/src/storage/perform_upload/buffered/progress.rs#L201-L204
The code performs `b.split_off(n - s)`, which returns the last `s` bytes rather than dropping the first `s` bytes and retaining the remaining `n - s` bytes. Unless `s == n / 2`, the resent data contains the wrong bytes and the wrong length, corrupting the object payload upon completion.
Contributor guide
Research direction
Start in src/storage/src/storage/perform_upload/buffered/progress.rs at handle_partial and inspect the 308 Resume Incomplete path when persisted_size falls inside a Bytes element. Verify the retained bytes are the portion after the persisted prefix, then run the relevant storage tests. Done means partial resumes resend the correct remaining bytes without corrupting the payload.
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
- Clearly specified
- Newbie friendliness
- 78/100