mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-22 04:05:39 +00:00
Merge remote-tracking branch
'origin/GP-4696_emteere_ClearFlowAndRepairDefinedData' into patch (Closes #6636)
This commit is contained in:
commit
4c154f570b
@ -4,9 +4,9 @@
|
|||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
@ -26,6 +26,7 @@ import ghidra.program.disassemble.Disassembler;
|
|||||||
import ghidra.program.disassemble.DisassemblerContextImpl;
|
import ghidra.program.disassemble.DisassemblerContextImpl;
|
||||||
import ghidra.program.model.address.*;
|
import ghidra.program.model.address.*;
|
||||||
import ghidra.program.model.block.*;
|
import ghidra.program.model.block.*;
|
||||||
|
import ghidra.program.model.data.Undefined;
|
||||||
import ghidra.program.model.lang.Register;
|
import ghidra.program.model.lang.Register;
|
||||||
import ghidra.program.model.lang.RegisterValue;
|
import ghidra.program.model.lang.RegisterValue;
|
||||||
import ghidra.program.model.listing.*;
|
import ghidra.program.model.listing.*;
|
||||||
@ -308,8 +309,17 @@ public class ClearFlowAndRepairCmd extends BackgroundCommand<Program> {
|
|||||||
}
|
}
|
||||||
// no instruction, check if data is there
|
// no instruction, check if data is there
|
||||||
Data data = listing.getDefinedDataAt(toAddr);
|
Data data = listing.getDefinedDataAt(toAddr);
|
||||||
|
// data or instruction not found at destination
|
||||||
if (data == null) {
|
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;
|
boolean clearIt = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user