From 2c031ed0963cfb3a37ba6c5d4b64d9bbc4250832 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sat, 30 Sep 2023 11:46:18 +0200 Subject: [PATCH] smacker: add forgotten recursion depth check --- nihav-rad/src/codecs/smacker.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/nihav-rad/src/codecs/smacker.rs b/nihav-rad/src/codecs/smacker.rs index d834c7e..7ecd443 100644 --- a/nihav-rad/src/codecs/smacker.rs +++ b/nihav-rad/src/codecs/smacker.rs @@ -94,6 +94,7 @@ const SMK_LAST_UNINIT: usize = 0xFFFFFFFF; impl SmackerTree16Builder { fn get_tree16(&mut self, br: &mut BitReader, tree: &mut SmackerTree16, depth: usize) -> DecoderResult { validate!(tree.tree.len() < self.nsyms); + validate!(depth <= 32); if !br.read_bool()? { let lo = br.read_tree8(&self.tree_lo)?; let hi = br.read_tree8(&self.tree_hi)?; -- 2.39.5