Skip to content

Commit 76856b4

Browse files
committed
Add depth guard to deserialize_value_typed
Prevents usize underflow when dict key deserialization path calls deserialize_value_typed with depth=0 on composite types.
1 parent 06afa65 commit 76856b4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

crates/compiler-core/src/marshal.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,9 @@ fn deserialize_value_typed<R: Read, Bag: MarshalBag>(
524524
refs: &mut Vec<Option<Bag::Value>>,
525525
typ: Type,
526526
) -> Result<Bag::Value> {
527+
if depth == 0 {
528+
return Err(MarshalError::InvalidBytecode);
529+
}
527530
let value = match typ {
528531
Type::True => bag.make_bool(true),
529532
Type::False => bag.make_bool(false),

0 commit comments

Comments
 (0)