-
Notifications
You must be signed in to change notification settings - Fork 120
Description
Hello,
There are several instances within zstd-rs where Vec::set_len are used:
zstd-rs/src/block/compressor.rs
Line 66 in cd0450d
buffer.set_len(buffer_len); |
zstd-rs/src/block/decompressor.rs
Line 58 in cd0450d
buffer.set_len(capacity); |
zstd-rs/src/stream/zio/writer.rs
Line 107 in cd0450d
self.buffer.set_len(capacity); |
Line 112 in cd0450d
result.set_len(max_size); |
Documentation for set_len safety states:
Safety
new_len must be less than or equal to capacity().
The elements at old_len..new_len must be initialized.
The second condition is not met in the instances linked above.
It would also be great if there were more documentation about safety invariants - the samples in the documentation above include examples. That would help establish confidence in the set_len calls following the FFI calls.