From: khizmax Date: Fri, 29 Jul 2016 15:51:05 +0000 (+0300) Subject: fixed potential buffer overflow X-Git-Tag: v2.2.0~170 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=df51f37347c12f42f142dc23858d6bd3cb60c84c;p=libcds.git fixed potential buffer overflow --- 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();