You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "metsw24-max (via GitHub)" <gi...@apache.org> on 2026/05/11 07:31:54 UTC

[PR] Fix ISO Latin-1 decoder sign extension [logging-log4cxx]

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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix ISO Latin-1 decoder sign extension [logging-log4cxx]

Posted by "swebb2066 (via GitHub)" <gi...@apache.org>.
swebb2066 merged PR #660:
URL: https://github.com/apache/logging-log4cxx/pull/660


-- 
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: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org