[ 
https://issues.apache.org/jira/browse/LOG4J2-3230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17462682#comment-17462682
 ] 

Peter Malone commented on LOG4J2-3230:
--------------------------------------

I'm trying to determine why removing *JndiLookup.class* appears to mitigate 
this issue on log4j-core-2.16.0.

I didn't think {*}JndiLookup.clas{*}s interacted with the *ThreadContext* 
Lookups at all.

However, prior to removing *JndiLookup.class* I observe the following:

{{}}
{code:java}
2021-12-20 10:36:56,215 main ERROR An exception occurred processing Appender 
LogToConsole java.lang.IllegalStateException: Infinite loop in property 
interpolation of ::-${::-$${::-j}}: : {code}
{{{}{}}}{{{}{}}}

Upon removal of *JndiLookup.class* I observe the following:
{code:java}
 10:42:12.698 [main] INFO  TestLog4j ${ctx:EXAMPLE} - test{code}


This is my {*}PatternLayout{*}: 
{code:java}
 <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} 
${ctx:EXAMPLE} - %msg%n"/>{code}

And this is the example code:
{code:java}
ThreadContext.put("EXAMPLE", "${${::-${::-$${::-j}}}}");
logger.info("test");{code}

Any ideas? Prior to removing the .class file I've tried setting break points in 
*JndiLookup.class* and the execution never gets there so I'm confused by this.

 

> Certain strings can cause infinite recursion
> --------------------------------------------
>
>                 Key: LOG4J2-3230
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3230
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.8, 2.8.1, 2.8.2, 2.9.0, 2.9.1, 2.10.0, 2.11.0, 2.11.1, 
> 2.11.2, 2.12.0, 2.12.1, 2.13.0, 2.13.1, 2.13.2, 2.14.0, 2.13.3, 2.14.1, 
> 2.15.0, 2.16.0
>            Reporter: Ross Cohen
>            Assignee: Carter Kozak
>            Priority: Major
>             Fix For: 2.17.0
>
>         Attachments: sample.tar.gz
>
>
> If a string substitution is attempted for any reason on the following string, 
> it will trigger an infinite recursion, and the application will crash: 
> ${${::\-${::\-$${::\-j}}}}.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to