We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent acaf8f1 commit a3af727Copy full SHA for a3af727
1 file changed
src/encode.rs
@@ -403,6 +403,12 @@ impl Encodable for Vec<u8> {
403
impl Decodable for Vec<u8> {
404
fn consensus_decode<D: crate::ReadExt>(mut d: D) -> Result<Self, Error> {
405
let s = VarInt::consensus_decode(&mut d)?.0 as usize;
406
+ if s > MAX_VEC_SIZE {
407
+ return Err(self::Error::OversizedVectorAllocation {
408
+ requested: s,
409
+ max: MAX_VEC_SIZE,
410
+ });
411
+ }
412
let mut v = vec![0; s];
413
d.read_slice(&mut v)?;
414
Ok(v)
0 commit comments