Skip to content
Browse files
Don't panic when a DefBuffer contains less bytes than its size
If a DefBuffer contains less bytes than its size, the remaining bytes should
be initialized to `0`. I overlooked that `copy_from_slice` requires that
its two slices are the same size, and so this panics in these cases. This
was picked up by fuzzing.
  • Loading branch information
IsaacWoods committed Dec 30, 2020
1 parent 4286dfc commit 0c64768
Showing 1 changed file with 1 addition and 1 deletion.
@@ -108,7 +108,7 @@ where

let mut buffer = vec![0; buffer_size];
(&mut buffer[0..bytes.len()]).copy_from_slice(bytes);
(Ok(buffer), context)

0 comments on commit 0c64768

Please sign in to comment.