metsw24-max opened a new pull request, #657:
URL: https://github.com/apache/logging-log4cxx/pull/657
The append() splitting loop computes chunk-end iterators as start +
maxMessageLength - 12 to reserve space for an "(x/y)" sequence suffix. With
maxMessageLength == 12 the chunk size is zero and the loop never advances,
growing the packets vector indefinitely. Smaller positive values walk the
iterator before msg.begin() before constructing LogString(start, end) with
start > end (undefined behaviour).
Validate the value in setMaxMessageLength so the public setter and the
setOption("MaxMessageLength", ...) configuration path both fall back to the
documented default when the configured value cannot satisfy the
suffix-reservation arithmetic.
## Changes
- Added validation in SyslogAppender::setMaxMessageLength()
- Values < 13 now fall back to the documented default value (1024)
- Added a warning when invalid values are supplied
- Both the public setter and the setOption("MAXMESSAGELENGTH", ...)
configuration path now share the same validation logic
Tests Added
## Added tests covering:
- boundary value 12
- negative values
- setOption("MAXMESSAGELENGTH", "5")
- regression test ensuring valid values (2048) remain unchanged
--
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]