Ghidra is a software reverse engineering (SRE) framework
GP-3186 Add 0 size exports to consistency check for subtables
caheckman349b8911655a
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.ccindex fb9e94d34b..b92a3de3b6 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc@@ -1004,7 +1004,7 @@ bool ConsistencyChecker::checkSectionTruncations(Constructor *ct,ConstructTpl *cbool ConsistencyChecker::checkSubtable(SubtableSymbol *sym){- int4 tablesize = 0;+ int4 tablesize = -1;int4 numconstruct = sym->getNumConstructors();Constructor *ct;bool testresult = true;@@ -1033,9 +1033,9 @@ bool ConsistencyChecker::checkSubtable(SubtableSymbol *sym)}seennonemptyexport = true;int4 exsize = recoverSize(exportres->getSize(),ct);- if (tablesize == 0)+ if (tablesize == -1)tablesize = exsize;- if ((exsize!=0)&&(exsize != tablesize)) {+ if (exsize != tablesize) {ostringstream msg;msg << "Table '" << sym->getName() << "' has inconsistent export size; ";msg << "Constructor starting at line " << dec << ct->getLineno() << " is first conflict";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.javaindex 8f19d6afdc..0c28b1734d 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@@ -725,7 +725,7 @@ class ConsistencyChecker {}private boolean checkSubtable(SubtableSymbol sym) {- int tablesize = 0;+ int tablesize = -1;int numconstruct = sym.getNumConstructors();Constructor ct;boolean testresult = true;@@ -757,10 +757,10 @@ class ConsistencyChecker {}seennonemptyexport = true;int exsize = recoverSize(exportres.getSize(), ct);- if (tablesize == 0) {+ if (tablesize == -1) {tablesize = exsize;}- if ((exsize != 0) && (exsize != tablesize)) {+ if (exsize != tablesize) {compiler.reportError(ct.location, String.format("Table '%s' has inconsistent export size; Constructor at %s is first conflict",sym.getName(), ct.location));