You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by sw...@apache.org on 2026/04/11 03:04:07 UTC

(logging-log4cxx) branch master updated: out-of-bounds write when CyclicBuffer is empty (#628)

This is an automated email from the ASF dual-hosted git repository.

swebb2066 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git


The following commit(s) were added to refs/heads/master by this push:
     new 98b3045f out-of-bounds write when CyclicBuffer is empty (#628)
98b3045f is described below

commit 98b3045f8a123c83ae989325e0214e3535eb271b
Author: jmestwa-coder <jm...@gmail.com>
AuthorDate: Sat Apr 11 08:34:01 2026 +0530

    out-of-bounds write when CyclicBuffer is empty (#628)
---
 src/main/cpp/cyclicbuffer.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/main/cpp/cyclicbuffer.cpp b/src/main/cpp/cyclicbuffer.cpp
index b27653c0..bc803a46 100644
--- a/src/main/cpp/cyclicbuffer.cpp
+++ b/src/main/cpp/cyclicbuffer.cpp
@@ -64,6 +64,11 @@ Add an <code>event</code> as the last event in the buffer.
 */
 void CyclicBuffer::add(const spi::LoggingEventPtr& event)
 {
+	if (m_priv->ea.empty())
+	{
+		return;
+	}
+
 	m_priv->ea[m_priv->last] = event;
 
 	if (++m_priv->last == m_priv->maxSize)