Fix locals not being restored properly (which may cause us to read garbage values from the stack)

This commit is contained in:
Jef
2018-12-17 12:16:40 +01:00
parent bd2ee53c89
commit 23b5a56a7d
5 changed files with 106 additions and 84 deletions

View File

@@ -158,7 +158,7 @@ pub fn translate(
// 0 it will branch here.
// After that reset stack depth to the value before entering `if` block.
define_label(&mut ctx, if_not);
restore_block_state(&mut ctx, block_state.clone());
end_block(&mut ctx, block_state.clone());
// Carry over the `end_label`, so it will be resolved when the corresponding `end`
// is encountered.
@@ -199,7 +199,7 @@ pub fn translate(
prepare_return_value(&mut ctx);
}
restore_block_state(&mut ctx, control_frame.block_state);
end_block(&mut ctx, control_frame.block_state);
push_block_return_value(&mut ctx);
}
Operator::I32Eq => relop_eq_i32(&mut ctx),