OxBat opened a new pull request, #590:
URL: https://github.com/apache/logging-log4cxx/pull/590
### Summary
I identified a Denial of Service vulnerability in
`OptionConverter::substVars`.
The component handles variable substitution (e.g., `${key}`) recursively.
**The Issues:**
1. **Stack Overflow (Crash):** `substVarsSafely` is recursive but had no
depth limit. A configuration with deeply nested variables (e.g., 20,000 levels)
caused a Segmentation Fault.
2. **Algorithmic Complexity (Freeze):** The cycle detection logic used a
linked list (`LogStringChain`) that required traversing the parent chain at
every step, resulting in O(N^2) complexity.
**The Fix:**
I refactored the internal `substVarsSafely` function:
1. Replaced the custom `LogStringChain` linked list with a
`std::vector<LogString>` for history tracking (faster lookup).
2. Added a `MAX_SUBST_DEPTH` (20). If recursion exceeds this depth, it
stops and logs a warning, preventing the crash.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]