metsw24-max opened a new pull request, #660:
URL: https://github.com/apache/logging-log4cxx/pull/660

   Fix sign-extension corruption in `ISOLatinCharsetDecoder::decode` when 
decoding bytes >= `0x80`.
   
   `charsetdecoder.cpp` previously converted input bytes using:
   
   ```cpp
   static_cast<unsigned int>(*src)
   ```
   
   Because `char` is signed by default on common MSVC/GCC/Clang x86/x64 builds, 
bytes in the range `0x80..0xFF` were sign-extended to `0xFFFFFFxx`. This caused 
`Transcoder::encode` to treat them as invalid Unicode values, producing 
`U+FFFD` on UTF-8 builds (or invalid `wchar_t` values on WCHAR builds).
   
   The fix casts through `unsigned char` first, matching the existing 
unsigned-byte handling patterns already used elsewhere in the codebase.
   
   ## Impact
   
   `properties.cpp` selects this decoder for Java `.properties` parsing, so any 
Latin-1 characters above ASCII in log4cxx configuration files could be silently 
corrupted. This affects cases such as:
   
   * accented file paths
   * logger names
   * layout patterns
   * localized configuration text
   
   ## Changes
   
   * Fix signed-char sign extension in `ISOLatinCharsetDecoder::decode`
   * Add `testISOLatinHighBytes`
   * Verify round-trip behavior for all bytes `0x80..0xFF`
   


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