Skip to content

Commit

Permalink
Merge pull request #59 from CERTCC/231201
Browse files Browse the repository at this point in the history
GhiHorn improvements
  • Loading branch information
sei-eschwartz authored Dec 1, 2023
2 parents f25e13d + 78833ee commit f5cdbdc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Current Release

## 231201

- Improvements:
* Improve HighCfg entry node heuristic
* Add additional logging when failing to create decompiler
* Ensure that start and goal addresses are valid instructions

## 231003

- Improvements:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public DecompInterface createDecompiler() {
options.grabFromToolAndProgram(null, opt, program);
} catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException | SecurityException e) {
throw new RuntimeException("Unable to create decompiler");
throw new RuntimeException("Unable to create decompiler: " + e.toString(), e);
}

decompiler.setOptions(options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import javax.swing.BorderFactory;
import javax.swing.JCheckBox;
Expand Down Expand Up @@ -415,11 +416,16 @@ public List<Map<String, Object>> getCommandParameters() throws Exception {
final Address endAddr = program.getAddressFactory().getDefaultAddressSpace()
.getAddress(goalAddrText.getText());

// Make sure that the program contains the specified addresses
if (!program.getMemory().contains(startAddr)
|| !program.getMemory().contains(endAddr)) {
throw new RuntimeException();
}
// Make sure that the program contains the specified addresses as instructions
Consumer<Address> verifyAddress = (Address addr) -> {
if (program.getListing().getInstructionAt(addr) == null) {
throw new RuntimeException("Start or goal address " + addr + " is not an instruction");
};
};

verifyAddress.accept(startAddr);
verifyAddress.accept(endAddr);

this.startAddrText.setText(startAddr.toString());

status("Looking for path from " + startAddr + " to " + endAddr);
Expand Down

0 comments on commit f5cdbdc

Please sign in to comment.