From 7a3e9ce2e33e5b8330aacdd0a6e4d0befe046d09 Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Thu, 1 Dec 2022 12:38:48 -0800 Subject: [PATCH] Fix reachability bug for default target of br_table. --- src/frontend.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/frontend.rs b/src/frontend.rs index 84f4741..69b54d3 100644 --- a/src/frontend.rs +++ b/src/frontend.rs @@ -1052,6 +1052,7 @@ impl<'a, 'b> FunctionBodyBuilder<'a, 'b> { // us the signature of all frames (since wasmparser // validates the input for us). Pop that many args. let default_frame = self.relative_frame(targets.default()); + default_frame.set_reachable(); let default_term_target = default_frame.br_target(); let arg_len = default_frame.br_args().len(); let args = self.pop_n(arg_len); @@ -1067,6 +1068,7 @@ impl<'a, 'b> FunctionBodyBuilder<'a, 'b> { term_targets.push(block); } self.emit_br_table(index, default_term_target, &term_targets[..], &args[..]); + self.locals.finish_block(self.reachable); self.reachable = false; }