From df51f37347c12f42f142dc23858d6bd3cb60c84c Mon Sep 17 00:00:00 2001 From: khizmax Date: Fri, 29 Jul 2016 18:51:05 +0300 Subject: [PATCH] fixed potential buffer overflow --- cds/intrusive/mspriority_queue.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cds/intrusive/mspriority_queue.h b/cds/intrusive/mspriority_queue.h index 41fd5689..ba3db521 100644 --- a/cds/intrusive/mspriority_queue.h +++ b/cds/intrusive/mspriority_queue.h @@ -291,7 +291,12 @@ namespace cds { namespace intrusive { } counter_type i = m_ItemCounter.inc(); - assert( i < m_Heap.capacity() ); + if ( i >= m_Heap.capacity() ) { + // the heap is full + m_Lock.unlock(); + m_Stat.onPushFailed(); + return false; + } node& refNode = m_Heap[i]; refNode.lock(); -- 2.34.1