Skip to content

Commit 290f183

Browse files
committed
Fix bug in API ArchAndAddr operator overload
1 parent 9b55003 commit 290f183

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

binaryninjaapi.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@ namespace BinaryNinja {
358358

359359
bool operator<(const Ref<T>& obj) const { return T::GetObject(m_obj) < T::GetObject(obj.m_obj); }
360360

361+
bool operator>(const T* obj) const { return T::GetObject(m_obj) > T::GetObject(obj); }
362+
363+
bool operator>(const Ref<T>& obj) const { return T::GetObject(m_obj) > T::GetObject(obj.m_obj); }
364+
361365
T* GetPtr() const { return m_obj; }
362366
};
363367

@@ -10898,18 +10902,10 @@ namespace BinaryNinja {
1089810902
}
1089910903
bool operator<(const ArchAndAddr& a) const
1090010904
{
10901-
/*
10902-
// TODO: revisit why this code doesn't seem to be using the Ref<T> operators correctly and causes
10903-
// crashes in some cases
1090410905
if (arch < a.arch)
1090510906
return true;
1090610907
if (arch > a.arch)
1090710908
return false;
10908-
*/
10909-
if (arch->GetObject() < a.arch->GetObject())
10910-
return true;
10911-
if (arch->GetObject() > a.arch->GetObject())
10912-
return false;
1091310909
return address < a.address;
1091410910
}
1091510911
ArchAndAddr() : arch(nullptr), address(0) {}

0 commit comments

Comments
 (0)