mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-22 04:05:39 +00:00
Fix FunctionStartAnalyzer's control flow
The continue keyword has no effect, when it should be breaking out of both loops to the outer one.
This commit is contained in:
parent
da8c3643e2
commit
d8bf2f9875
@ -718,14 +718,8 @@ public class FunctionStartAnalyzer extends AbstractAnalyzer implements PatternFa
|
||||
while (addresses.hasNext() && !addedMonitor.isCancelled()) {
|
||||
Address address = addresses.next();
|
||||
// if there are any conditional references, then this can't be a function start
|
||||
ReferenceIterator referencesTo =
|
||||
addedProgram.getReferenceManager().getReferencesTo(address);
|
||||
while (referencesTo.hasNext()) {
|
||||
Reference reference = referencesTo.next();
|
||||
if (reference.getReferenceType().isConditional()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (hasConditionalReferences(addedProgram, address)) {
|
||||
continue;
|
||||
}
|
||||
Function funcAt =
|
||||
addedProgram.getFunctionManager().getFunctionContaining(address);
|
||||
@ -743,6 +737,18 @@ public class FunctionStartAnalyzer extends AbstractAnalyzer implements PatternFa
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean hasConditionalReferences(Program addedProgram, Address address) {
|
||||
ReferenceIterator refsTo =
|
||||
addedProgram.getReferenceManager().getReferencesTo(address);
|
||||
while (refsTo.hasNext()) {
|
||||
Reference reference = refsTo.next();
|
||||
if (reference.getReferenceType().isConditional()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}, potentialFuncResult);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user