diff --git a/rust/candid/src/binary_parser.rs b/rust/candid/src/binary_parser.rs index 03a7b6e2..d0c1ea0e 100644 --- a/rust/candid/src/binary_parser.rs +++ b/rust/candid/src/binary_parser.rs @@ -129,7 +129,7 @@ pub struct Len( pub struct PrincipalBytes { #[br(assert(flag == 1u8, "Opaque reference not supported"))] pub flag: u8, - #[br(parse_with = read_leb)] + #[br(parse_with = read_leb, assert(len <= 29, "Principal is longer than 29 bytes"))] pub len: u64, #[br(count = len)] pub inner: Vec,