mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-24 21:21:56 +00:00
GP-4696 Clear data from a clearflow and repair, only if the information
there could have been created from simple disassembly
This commit is contained in:
parent
7c3868c00e
commit
535645f6a7
@ -26,6 +26,7 @@ import ghidra.program.disassemble.Disassembler;
|
||||
import ghidra.program.disassemble.DisassemblerContextImpl;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.block.*;
|
||||
import ghidra.program.model.data.Undefined;
|
||||
import ghidra.program.model.lang.Register;
|
||||
import ghidra.program.model.lang.RegisterValue;
|
||||
import ghidra.program.model.listing.*;
|
||||
@ -308,8 +309,17 @@ public class ClearFlowAndRepairCmd extends BackgroundCommand<Program> {
|
||||
}
|
||||
// no instruction, check if data is there
|
||||
Data data = listing.getDefinedDataAt(toAddr);
|
||||
// data or instruction not found at destination
|
||||
if (data == null) {
|
||||
continue; // instruction not found at destination
|
||||
continue; // don't add to clear set
|
||||
}
|
||||
// has an external reference from data, not produced from bad flow
|
||||
if (data.getExternalReference(0) != null) {
|
||||
continue; // don't add to clear set
|
||||
}
|
||||
// if defined data is anything other than Undefined1,2... or a pointer
|
||||
if (data.isDefined() && !(data.getDataType() instanceof Undefined) && !(data.isPointer())) {
|
||||
continue; // don't add to clear set
|
||||
}
|
||||
}
|
||||
boolean clearIt = true;
|
||||
|
Loading…
Reference in New Issue
Block a user