Ghidra is a software reverse engineering (SRE) framework
GP-3292 Fix initializeForReading in case where there is only 1 value
caheckmane02c6002344a
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.ccindex 47d220df0a..a068f9493c 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.cc+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.cc@@ -341,9 +341,14 @@ bool JumpValuesRangeDefault::contains(uintb val) constbool JumpValuesRangeDefault::initializeForReading(void) const{- if (range.getSize()==0) return false;- curval = range.getMin();- lastvalue = false;+ if (range.getSize()==0) {+ curval = extravalue;+ lastvalue = true;+ }+ else {+ curval = range.getMin();+ lastvalue = false;+ }return true;}diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.hhindex 4c9b6d552d..6cb78c547d 100644--- a/Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.hh+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/jumptable.hh@@ -217,7 +217,7 @@ class JumpValuesRangeDefault : public JumpValuesRange {uintb extravalue; ///< The extra valueVarnode *extravn; ///< The starting Varnode associated with the extra valuePcodeOp *extraop; ///< The starting PcodeOp associated with the extra value- mutable bool lastvalue; ///< \b true is the extra value has been visited by the iterator+ mutable bool lastvalue; ///< \b true if the extra value has been visited by the iteratorpublic:void setExtraValue(uintb val) { extravalue = val; } ///< Set the extra value explicitlyvoid setDefaultVn(Varnode *vn) { extravn = vn; } ///< Set the associated start Varnode