From 5f90941c8ca5deed884408d3f813710ec92ca1ff Mon Sep 17 00:00:00 2001 From: Beq Date: Mon, 17 Nov 2025 15:37:58 +0000 Subject: [PATCH] Fix Linux gcc-14 builds: prevent null passing in to memcmp --- indra/llcommon/lltreeiterators.h | 68 ++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 4 deletions(-) diff --git a/indra/llcommon/lltreeiterators.h b/indra/llcommon/lltreeiterators.h index cef501b987..22b21af955 100644 --- a/indra/llcommon/lltreeiterators.h +++ b/indra/llcommon/lltreeiterators.h @@ -238,7 +238,22 @@ private: mParents.pop_back(); } /// equality - bool equal(const self_type& that) const { return this->mParents == that.mParents; } + bool equal(const self_type& that) const + { + if (this == &that) + { + return true; + } + + const bool empty = mParents.empty(); + const bool that_empty = that.mParents.empty(); + if (empty || that_empty) + { + return empty && that_empty; + } + + return mParents == that.mParents; + } /// implement dereference/indirection operators ptr_type& dereference() const { return const_cast(mParents.back()); } @@ -373,7 +388,22 @@ private: mSkipChildren = false; } /// equality - bool equal(const self_type& that) const { return this->mPending == that.mPending; } + bool equal(const self_type& that) const + { + if (this == &that) + { + return true; + } + + const bool empty = mPending.empty(); + const bool that_empty = that.mPending.empty(); + if (empty || that_empty) + { + return empty && that_empty; + } + + return mPending == that.mPending; + } /// implement dereference/indirection operators ptr_type& dereference() const { return const_cast(mPending.back()); } @@ -474,7 +504,22 @@ private: makeCurrent(); } /// equality - bool equal(const self_type& that) const { return this->mPending == that.mPending; } + bool equal(const self_type& that) const + { + if (this == &that) + { + return true; + } + + const bool empty = mPending.empty(); + const bool that_empty = that.mPending.empty(); + if (empty || that_empty) + { + return empty && that_empty; + } + + return mPending == that.mPending; + } /// implement dereference/indirection operators ptr_type& dereference() const { return const_cast(mPending.back().first); } @@ -611,7 +656,22 @@ private: mPending.push_back(*chi); } /// equality - bool equal(const self_type& that) const { return this->mPending == that.mPending; } + bool equal(const self_type& that) const + { + if (this == &that) + { + return true; + } + + const bool empty = mPending.empty(); + const bool that_empty = that.mPending.empty(); + if (empty || that_empty) + { + return empty && that_empty; + } + + return mPending == that.mPending; + } /// implement dereference/indirection operators ptr_type& dereference() const { return const_cast(mPending.front()); }