Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-987 Instruction operand hover bug

emteere40c5d4148cec
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/hover/ScalarOperandListingHover.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/hover/ScalarOperandListingHover.java
index edd40669e5..f0e3b9eca6 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/hover/ScalarOperandListingHover.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/codebrowser/hover/ScalarOperandListingHover.java
@@ -102,7 +102,12 @@ public class ScalarOperandListingHover extends AbstractScalarOperandHover
if (list == null) {
return null;
}
- return list.get(loc.getSubOperandIndex());
+ // make sure operand sub-opIndex is in bounds
+ int subOpIndex = loc.getSubOperandIndex();
+ if (subOpIndex < 0 || subOpIndex >= list.size()) {
+ return null;
+ }
+ return list.get(subOpIndex);
}
}