Merge pull request #525 from jswrenn/fix-serde-deserialization-panic

Fix out-of-bounds panic during deserialization; produce error instead
This commit is contained in:
Sébastien Crozet 2019-02-03 07:31:03 +01:00 committed by GitHub
commit 9167965252
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -331,7 +331,7 @@ where
let mut curr = 0; let mut curr = 0;
while let Some(value) = try!(visitor.next_element()) { while let Some(value) = try!(visitor.next_element()) {
out[curr] = value; *out.get_mut(curr).ok_or_else(|| V::Error::invalid_length(curr, &self))? = value;
curr += 1; curr += 1;
} }