jmestwa-coder opened a new pull request, #665:
URL: https://github.com/apache/logging-log4cxx/pull/665
## Summary
Improve `StringHelper::toInt` and `StringHelper::toInt64` to reject
malformed numeric input with trailing non-whitespace characters instead of
silently accepting partial parses.
Examples of previously accepted input:
- `"123abc"` → parsed as `123`
- `"514udp"` → parsed as `514`
This change now requires the full numeric string to be consumed (excluding
trailing whitespace).
## Changes
- Added full-consumption validation after `std::stoi` / `std::stoll`
- Preserved support for surrounding whitespace and signed values
- Switched to `LOG4CXX_ENCODE_CHAR` for consistent cross-platform
`LogString` handling
- Added regression tests covering:
- trailing characters
- empty input
- whitespace-only input
- embedded whitespace
- signed numbers
## Rationale
`OptionConverter::toInt` already rejects trailing characters using
full-string validation. This change aligns `StringHelper` numeric parsing
behavior with the existing strict parsing semantics used elsewhere in the
project and avoids silently accepting malformed numeric configuration values.
--
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]