Fix out-of-bounds panic during deserialization; produce error instead.

Fixes #522
This commit is contained in:
Jack Wrenn 2019-01-16 11:20:56 -05:00
parent 5569850dbd
commit 6426a7cb6f
1 changed files with 1 additions and 1 deletions

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;
} }