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/28 05:00:14 UTC

(logging-log4cxx) branch prevent_stack_overflow created (now 13147179)

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

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


      at 13147179 Reduce stack overflow likelihood processing XML configurations

This branch includes the following new commits:

     new 13147179 Reduce stack overflow likelihood processing XML configurations

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(logging-log4cxx) 01/01: Reduce stack overflow likelihood processing XML configurations

Posted by sw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 131471795c6549137e435f6d80c36b28e7d7fabe
Author: Stephen Webb <sw...@gmail.com>
AuthorDate: Tue Apr 28 14:59:52 2026 +1000

    Reduce stack overflow likelihood processing XML configurations
---
 src/main/cpp/domconfigurator.cpp | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/main/cpp/domconfigurator.cpp b/src/main/cpp/domconfigurator.cpp
index 6daa4a3f..0f7352e9 100644
--- a/src/main/cpp/domconfigurator.cpp
+++ b/src/main/cpp/domconfigurator.cpp
@@ -218,24 +218,24 @@ Used internally to parse appenders by IDREF name.
 AppenderPtr DOMConfigurator::DOMConfiguratorPrivate::findAppenderByName(apr_xml_elem* element, const LogString& appenderName)
 {
 	AppenderPtr appender;
-	std::string tagName(element->name);
 
-	if (tagName == APPENDER_TAG)
+	while (element)
 	{
-		if (appenderName == getAttribute(element, NAME_ATTR))
+		if (std::string(element->name) == APPENDER_TAG)
 		{
-			appender = parseAppender(element);
+			if (appenderName == getAttribute(element, NAME_ATTR))
+			{
+				if (appender = parseAppender(element))
+					break;
+			}
 		}
-	}
 
-	if (element->first_child && !appender)
-	{
-		appender = findAppenderByName(element->first_child, appenderName);
-	}
-
-	if (element->next && !appender)
-	{
-		appender = findAppenderByName(element->next, appenderName);
+		if (element->first_child)
+		{
+			if (appender = findAppenderByName(element->first_child, appenderName))
+				break;
+		}
+		element = element->next;
 	}
 
 	return appender;