From 15dc9c089a1bf74057e2e1f9fce883a7dfb77684 Mon Sep 17 00:00:00 2001 From: Yan Chen <48968912+chenyan-dfinity@users.noreply.github.com> Date: Fri, 2 Feb 2024 21:24:51 -0800 Subject: [PATCH] fix --- rust/candid/src/de.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rust/candid/src/de.rs b/rust/candid/src/de.rs index 23c2e821..c8bb643b 100644 --- a/rust/candid/src/de.rs +++ b/rust/candid/src/de.rs @@ -823,7 +823,7 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> { { check_recursion! { self.unroll_type()?; - self.dec_value_cost(2)?; + self.dec_value_cost(1)?; match (self.expect_type.as_ref(), self.wire_type.as_ref()) { (TypeInner::Vec(e), TypeInner::Vec(w)) => { let e = self.table.trace_type(e)?; @@ -1095,6 +1095,7 @@ impl<'de, 'a> de::MapAccess<'de> for Compound<'a, 'de> { if *len == 0 { return Ok(None); } + self.de.dec_value_cost(1)?; self.de.expect_type = expect.0.clone(); self.de.wire_type = wire.0.clone(); *len -= 1;