Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-7155 Use the correct HandleTpl size in optimizeGather

caheckman031cdcaa42a8
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc
index 9c57c9e44d..e84eeca8c2 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc
@@ -1487,7 +1487,7 @@ void ConsistencyChecker::optimizeGather2(Constructor *ct,UniqueState &state,int4
if ((hand->getPtrSpace().getType() == ConstTpl::real)&&
(hand->getPtrOffset().getType() == ConstTpl::real)) {
uintb offset = hand->getPtrOffset().getReal();
- int4 size = hand->getPtrSize().getReal();
+ int4 size = hand->getSize().getReal();
vector<OptimizeRecord*> defs;
state.getDefinitions(defs,offset,size);
for (vector<OptimizeRecord*>::iterator iter=defs.begin();iter!=defs.end();++iter) {
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcodeCPort/slgh_compile/ConsistencyChecker.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcodeCPort/slgh_compile/ConsistencyChecker.java
index baee4e4730..60168ab140 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcodeCPort/slgh_compile/ConsistencyChecker.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/pcodeCPort/slgh_compile/ConsistencyChecker.java
@@ -1126,7 +1126,7 @@ class ConsistencyChecker {
if ((hand.getPtrSpace().getType() == ConstTpl.const_type.real) &&
(hand.getPtrOffset().getType() == ConstTpl.const_type.real)) {
long offset = hand.getPtrOffset().getReal();
- int size = (int) hand.getPtrSize().getReal();
+ int size = (int) hand.getSize().getReal();
for (OptimizeRecord rec : state.getDefinitions(offset, size)) {
rec.updateExport();
// NOTE: Could this just be updateRead?