rust/src/libstd/rt/io
bors d5e9033a0d auto merge of #9108 : blake2-ppc/rust/hazards-on-overflow, r=alexcrichton
Fix uint overflow bugs in std::{at_vec, vec, str}

Closes #8742

Fix issue #8742, which summarized is: unsafe code in vec and str did assume
that a reservation for `X + Y` elements always succeeded, and didn't overflow.

Introduce the method `Vec::reserve_additional(n)` to make it easy to check for
overflow in `Vec::push` and `Vec::push_all`.

In std::str, simplify and remove a lot of the unsafe code and use `push_str`
instead. With improvements to `.push_str` and the new function
`vec::bytes::push_bytes`, it looks like this change has either no or positive
impact on performance.

I believe there are many places still where `v.reserve(A + B)` still can overflow.
This by itself is not an issue unless followed by (unsafe) code that steps aside
boundary checks.
2013-09-16 19:35:50 -07:00
..
native libstd: Rename libcore to libstd and libstd to libextra; update makefiles. 2013-05-22 21:57:05 -07:00
net std::rt::io::net::tcp: Fix one tcp test on Win32 2013-09-16 03:45:20 +09:00
buffered.rs Stop using newtypes in rt::io::buffered 2013-09-12 21:48:47 -07:00
comm_adapters.rs Forbid pub/priv where it has no effect 2013-08-12 23:20:46 -07:00
extensions.rs rt::io: Use vec::reserve_additional 2013-09-17 02:48:00 +02:00
file.rs std::rt::io::file: Enable I/O tests on Win32 2013-09-15 23:20:33 +09:00
flate.rs Rename str::from_bytes to str::from_utf8, closes #8985 2013-09-05 14:17:24 +02:00
mem.rs Add with_mem_writer to std::rt::io::mem. 2013-09-06 21:21:59 -07:00
mock.rs libstd: Fix merge fallout. 2013-05-22 21:57:11 -07:00
mod.rs Buffered I/O wrappers 2013-09-10 21:26:28 -07:00
option.rs Make I/O tests use run_in_mt_newsched_task to get more multi-threaded test coverage 2013-09-06 11:13:43 -07:00
stdio.rs automated whitespace fixes 2013-06-13 18:03:08 -04:00
support.rs std::rt::io::support: Fix ignored test on Win32 2013-09-16 03:30:10 +09:00
timer.rs std::rt: Add a standalone sleep function. 2013-09-15 00:20:48 +10:00