Open seritools opened 2 years ago
https://github.com/technocreatives/core2/blob/d2d4681c13dfef88ac5fe0ced8d3cb98ccdee85c/src/io/buffered.rs#L612-613 https://github.com/technocreatives/core2/blob/d2d4681c13dfef88ac5fe0ced8d3cb98ccdee85c/src/io/buffered.rs#L631-633
copy_from_slice panics if the slices are of different length. The code does not limit self.buf to the correct slice offset and length needed for this call to ever succeed.
copy_from_slice
self.buf
I think it should have been something like
self.buf[self.len..][..buf.len()].copy_from_slice(buf);
Maybe it makes sense to grab the implementation for that from the current stdlib code?
https://github.com/technocreatives/core2/blob/d2d4681c13dfef88ac5fe0ced8d3cb98ccdee85c/src/io/buffered.rs#L612-613 https://github.com/technocreatives/core2/blob/d2d4681c13dfef88ac5fe0ced8d3cb98ccdee85c/src/io/buffered.rs#L631-633
copy_from_slice
panics if the slices are of different length. The code does not limitself.buf
to the correct slice offset and length needed for this call to ever succeed.I think it should have been something like
Maybe it makes sense to grab the implementation for that from the current stdlib code?