diff --git a/androscalpel/src/code_analysis/method_cfg.rs b/androscalpel/src/code_analysis/method_cfg.rs index 6a43524..10d7c7d 100644 --- a/androscalpel/src/code_analysis/method_cfg.rs +++ b/androscalpel/src/code_analysis/method_cfg.rs @@ -159,7 +159,6 @@ impl<'a> MethodCFG<'a> { last_labels.push(name.clone()); } else { nodes_next_label.push(vec![]); - last_labels.push(name.clone()); nodes.push(MethodCFGNode { code_block: &insns[start_last_block..i], labels: last_labels, @@ -167,7 +166,7 @@ impl<'a> MethodCFG<'a> { prev_nodes: vec![], }); start_last_block = i; - last_labels = vec![]; + last_labels = vec![name.clone()]; } } Instruction::ReturnVoid {} diff --git a/androscalpel/src/code_analysis/register_type.rs b/androscalpel/src/code_analysis/register_type.rs index 52584a8..c294517 100644 --- a/androscalpel/src/code_analysis/register_type.rs +++ b/androscalpel/src/code_analysis/register_type.rs @@ -73,11 +73,11 @@ impl MethodCFG<'_> { i += 1; } } - let mut changed = true; while changed { - let mut new_end_block_reg_tys = vec![]; - for node in &self.nodes { + // The first node is empty and depend on the function signature, it must not change + let mut new_end_block_reg_tys = vec![end_block_reg_tys[0].clone()]; + for node in self.nodes.iter().skip(1) { new_end_block_reg_tys.push(transform_reg_ty( &merge_input(node, nb_reg, &end_block_reg_tys), node,