aboutsummaryrefslogtreecommitdiff
path: root/src/bytes.rs
diff options
context:
space:
mode:
authorGravatar Pavel Strakhov <ri@idzaaus.org> 2019-04-03 02:24:30 +0300
committerGravatar Carl Lerche <me@carllerche.com> 2019-04-02 16:24:30 -0700
commitd43e283e5ed520e54df2428f2cf9a7c13c79ff49 (patch)
treef8d977db52e3962c373d08c3eb7df8cfb431fe43 /src/bytes.rs
parente0e30f00a1248b1de59405da66cd871ccace4f9f (diff)
downloadbytes-d43e283e5ed520e54df2428f2cf9a7c13c79ff49.tar.gz
bytes-d43e283e5ed520e54df2428f2cf9a7c13c79ff49.tar.zst
bytes-d43e283e5ed520e54df2428f2cf9a7c13c79ff49.zip
Panic in BytesMut::split_to when out of bounds (#252) (#253)v0.4.x
Diffstat (limited to 'src/bytes.rs')
-rw-r--r--src/bytes.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/bytes.rs b/src/bytes.rs
index e155931..a9aefa9 100644
--- a/src/bytes.rs
+++ b/src/bytes.rs
@@ -1265,6 +1265,8 @@ impl BytesMut {
///
/// Panics if `at > len`.
pub fn split_to(&mut self, at: usize) -> BytesMut {
+ assert!(at <= self.len());
+
BytesMut {
inner: self.inner.split_to(at),
}