OxBat opened a new pull request, #585:
URL: https://github.com/apache/logging-log4cxx/pull/585

   ### Summary
   I identified a platform-dependent integer overflow in 
`OptionConverter::toFileSize`.
   The library previously used `long` for file size calculations. On Windows 
(MSVC), `long` is strictly 32-bit (LLP64 data model), whereas it is 64-bit on 
Linux (LP64).
   
   **The Issue:**
   Configuring `MaxFileSize="3GB"` on Windows triggers a signed integer 
overflow:
   `3 * 1024^3` = `3,221,225,472` -> wraps to `-1,073,741,824` (negative).
   This negative value is passed to RollingFileAppender, causing logic errors 
(DoS via infinite rotation or rotation failure).
   
   **The Fix:**
   I updated the API signature in `optionconverter.h` and the implementation in 
`optionconverter.cpp` to use `long long` (guaranteed 64-bit on all platforms) 
and leveraged `StringHelper::toInt64`.
   
   ### Impact
   1. **Fixes the Crash/DoS:** Prevents negative file size limits.
   2. **Enables Feature:** Windows users can finally use log files larger than 
2GB, ensuring parity with Linux.


-- 
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]

Reply via email to