From 987b524193b096e6b7a05d02ecca782987d7dc5a Mon Sep 17 00:00:00 2001 From: caheckman <48068198+caheckman@users.noreply.github.com> Date: Tue, 31 May 2022 20:32:35 -0400 Subject: [PATCH] GP-2082 Guarantee only a single switch edge is labeled default --- .../Features/Decompiler/src/decompile/cpp/block.cc | 12 ++++++++++++ .../Features/Decompiler/src/decompile/cpp/block.hh | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/block.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/block.cc index 985e3e97db..201595af16 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/block.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/block.cc @@ -301,6 +301,18 @@ void FlowBlock::setGotoBranch(int4 i) outofthis[i].point->flags |= f_interior_gotoin; } +/// The switch can have exactly 1 default edge, so we make sure other edges are not marked. +/// \param pos is the index of the \e out edge that should be the default +void FlowBlock::setDefaultSwitch(int4 pos) + +{ + for(int4 i=0;i