servo/tendril

TendrilSink::ReadFrom should only use uninitialized bytes for Files

Opened this issue · 0 comments

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 #4.

This seems icky, no? Couldn't one fix this with different code paths for R=File and any other R=io::Read?