mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
Merge remote-tracking branch 'origin/GP-1502_emteere_FID_runningtwice' into patch
This commit is contained in:
commit
e9674b6fde
1 changed files with 34 additions and 3 deletions
|
@ -15,16 +15,23 @@
|
|||
*/
|
||||
package ghidra.feature.fid.analyzer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
||||
import ghidra.app.plugin.core.analysis.AutoAnalysisManager;
|
||||
import ghidra.app.services.*;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.feature.fid.cmd.ApplyFidEntriesCommand;
|
||||
import ghidra.feature.fid.service.FidService;
|
||||
import ghidra.feature.fid.db.FidQueryService;
|
||||
import ghidra.feature.fid.service.*;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.program.model.address.AddressSetView;
|
||||
import ghidra.program.model.listing.Function;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.model.mem.MemoryAccessException;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.exception.VersionException;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
||||
/**
|
||||
|
@ -105,6 +112,11 @@ public class FidAnalyzer extends AbstractAnalyzer {
|
|||
Msg.warn(this, "No FID Libraries apply for language " + program.getLanguageID());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isFullExecutable(program, set)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ApplyFidEntriesCommand cmd;
|
||||
cmd = new ApplyFidEntriesCommand(set, scoreThreshold, multiScoreThreshold,
|
||||
alwaysApplyFidLabels, createBookmarksEnabled);
|
||||
|
@ -112,11 +124,30 @@ public class FidAnalyzer extends AbstractAnalyzer {
|
|||
|
||||
// Name Change can change the nature of a function from a system
|
||||
// library. Probably a better way to do this.
|
||||
AutoAnalysisManager.getAnalysisManager(program).functionModifierChanged(
|
||||
cmd.getFIDLocations());
|
||||
AutoAnalysisManager.getAnalysisManager(program)
|
||||
.functionModifierChanged(cmd.getFIDLocations());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if set contains the full executable or loaded/initialized memory areas.
|
||||
*
|
||||
* @param program program to check
|
||||
* @param set set to check
|
||||
* @return true if all program executable or load/initialized memory is in set
|
||||
*/
|
||||
private boolean isFullExecutable(Program program, AddressSetView set) {
|
||||
// if has an execute set, then set to FID, must contain the execute set
|
||||
AddressSetView executeSet = program.getMemory().getExecuteSet();
|
||||
if (!executeSet.isEmpty()) {
|
||||
return set.contains(executeSet);
|
||||
}
|
||||
|
||||
// if there are no execute blocks, then use loaded/initialized for program blocks
|
||||
AddressSetView loadSet = program.getMemory().getLoadedAndInitializedAddressSet();
|
||||
return set.contains(loadSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerOptions(Options options, Program program) {
|
||||
options.registerOption(SCORE_THRESHOLD_OPTION_NAME, service.getDefaultScoreThreshold(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue