TendrilSink::ReadFrom should only use uninitialized bytes for Files
Open
Nobody has claimed this yet.
tendril
- Dominant language
- Rust
- Stars
- 2.6k
- Forks
- 288
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 8
Description
The code:
// FIXME: this exposes uninitialized bytes to a generic R type
// this is fine for R=File which never reads these bytes,
// but user-defined types might.
// The standard library pushes zeros to `Vec<u8>` for that reason.
unsafe {
tendril.push_uninitialized(BUFFER_SIZE);
}```
See also servo/tendril#4.
This seems icky, no? Couldn't one fix this with different code paths for R=File and any other R=io::Read?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the TendrilSink::ReadFrom implementation containing the shown push_uninitialized call, then read servo/tendril#4 for the related concern. Confirm how File differs from other io::Read implementations; done means user-defined readers cannot observe uninitialized bytes while the existing File behavior remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100