summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2020-10-12 21:58:20 -0400
committerRusty Wagner <rusty@vector35.com>2020-10-12 21:58:20 -0400
commit8210d6ed685415cfc545d66166d008377792fb1a (patch)
treeee2a9d75ee194cf27f3c016a30184f62949b83b2
parentd57335f3649f34cdf0247f46b7880a7882d82c9c (diff)
Fix stale references when modifying in place
-rw-r--r--mediumlevelilinstruction.cpp12
-rw-r--r--mediumlevelilinstruction.h3
2 files changed, 1 insertions, 14 deletions
diff --git a/mediumlevelilinstruction.cpp b/mediumlevelilinstruction.cpp
index 3d90d7d2..b535ef5a 100644
--- a/mediumlevelilinstruction.cpp
+++ b/mediumlevelilinstruction.cpp
@@ -380,11 +380,7 @@ MediumLevelILIntegerList::ListIterator& MediumLevelILIntegerList::ListIterator::
if (operand >= 4)
{
operand = 0;
-#ifdef BINARYNINJACORE_LIBRARY
- instr = &function->GetRawExpr((size_t)instr->operands[4]);
-#else
instr = function->GetRawExpr((size_t)instr.operands[4]);
-#endif
}
return *this;
}
@@ -392,11 +388,7 @@ MediumLevelILIntegerList::ListIterator& MediumLevelILIntegerList::ListIterator::
uint64_t MediumLevelILIntegerList::ListIterator::operator*()
{
-#ifdef BINARYNINJACORE_LIBRARY
- return instr->operands[operand];
-#else
return instr.operands[operand];
-#endif
}
@@ -404,11 +396,7 @@ MediumLevelILIntegerList::MediumLevelILIntegerList(MediumLevelILFunction* func,
const BNMediumLevelILInstruction& instr, size_t count)
{
m_start.function = func;
-#ifdef BINARYNINJACORE_LIBRARY
- m_start.instr = &instr;
-#else
m_start.instr = instr;
-#endif
m_start.operand = 0;
m_start.count = count;
}
diff --git a/mediumlevelilinstruction.h b/mediumlevelilinstruction.h
index 42567834..0cd8fde9 100644
--- a/mediumlevelilinstruction.h
+++ b/mediumlevelilinstruction.h
@@ -203,11 +203,10 @@ namespace BinaryNinja
{
#ifdef BINARYNINJACORE_LIBRARY
MediumLevelILFunction* function;
- const BNMediumLevelILInstruction* instr;
#else
Ref<MediumLevelILFunction> function;
- BNMediumLevelILInstruction instr;
#endif
+ BNMediumLevelILInstruction instr;
size_t operand, count;
bool operator==(const ListIterator& a) const;