mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
GP-3150 Fix potential waffling of RETURN/BRANCH on pop of pc if bad
flows are present function flowing into another function.
This commit is contained in:
parent
61a2b8335c
commit
4443a7ab19
2 changed files with 10 additions and 1 deletions
|
@ -425,7 +425,8 @@ public class ConstantPropagationAnalyzer extends AbstractAnalyzer {
|
||||||
final Function func = program.getFunctionManager().getFunctionContaining(start);
|
final Function func = program.getFunctionManager().getFunctionContaining(start);
|
||||||
if (func != null) {
|
if (func != null) {
|
||||||
AddressSetView body = func.getBody();
|
AddressSetView body = func.getBody();
|
||||||
if (set != null && body.getNumAddresses() > set.getNumAddresses()) {
|
// don't override flow set if only one address
|
||||||
|
if (body.getNumAddresses() > 1) {
|
||||||
flowSet = body;
|
flowSet = body;
|
||||||
}
|
}
|
||||||
flowStart = func.getEntryPoint();
|
flowStart = func.getEntryPoint();
|
||||||
|
|
|
@ -95,6 +95,10 @@ public class ArmAnalyzer extends ConstantPropagationAnalyzer {
|
||||||
!instr.getFlowType().isTerminal()) {
|
!instr.getFlowType().isTerminal()) {
|
||||||
// need to set the return override
|
// need to set the return override
|
||||||
instr.setFlowOverride(FlowOverride.RETURN);
|
instr.setFlowOverride(FlowOverride.RETURN);
|
||||||
|
// get rid of any references that might have been put on from
|
||||||
|
// bad flows
|
||||||
|
ReferenceManager refMgr = program.getReferenceManager();
|
||||||
|
refMgr.removeAllReferencesFrom(instr.getAddress());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if LR is a constant and is set right after this, this is a call
|
// if LR is a constant and is set right after this, this is a call
|
||||||
|
@ -109,6 +113,10 @@ public class ArmAnalyzer extends ConstantPropagationAnalyzer {
|
||||||
if (hasDataReferenceTo(program, addr)) {
|
if (hasDataReferenceTo(program, addr)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// if flow already over-ridden don't override again
|
||||||
|
if (instr.getFlowOverride() != FlowOverride.NONE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
instr.setFlowOverride(FlowOverride.CALL);
|
instr.setFlowOverride(FlowOverride.CALL);
|
||||||
// need to trigger disassembly below! if not already
|
// need to trigger disassembly below! if not already
|
||||||
doArmThumbDisassembly(program, instr, context, addr,
|
doArmThumbDisassembly(program, instr, context, addr,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue