From c0fab438a565cb2134679af8830d11644668d6a2 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 20 Nov 2020 17:24:35 -0500 Subject: Bug fixes: Memory leak/off by one on UIntSet (#1616) * #include an absolute path didn't work - because paths were taken to always be relative. * Fix memory leak on ScopedAllocation. Fix off by one bug on UIntSet --- source/core/slang-uint-set.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/core/slang-uint-set.h') diff --git a/source/core/slang-uint-set.h b/source/core/slang-uint-set.h index 7833ffa25..f89f37df2 100644 --- a/source/core/slang-uint-set.h +++ b/source/core/slang-uint-set.h @@ -61,6 +61,9 @@ public: /// Store the intersection between this and set in this void intersectWith(const UIntSet& set); + /// + bool isEmpty() const; + /// Store the union of set1 and set2 in outRs static void calcUnion(UIntSet& outRs, const UIntSet& set1, const UIntSet& set2); /// Store the intersection of set1 and set2 in outRs @@ -99,7 +102,7 @@ inline void UIntSet::remove(UInt val) inline bool UIntSet::contains(UInt val) const { const Index idx = Index(val >> kElementShift); - return idx <= m_buffer.getCount() && + return idx < m_buffer.getCount() && ((m_buffer[idx] & (Element(1) << (val & kElementMask))) != 0); } -- cgit v1.2.3