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

   ### Summary
   I identified a Remote Denial of Service vulnerability in `CharsetDecoder` 
(specifically `APRCharsetDecoder`).
   When processing untrusted network input, malformed byte sequences trigger an 
infinite loop.
   
   **The Loop:**
   When `apr_xlate_conv_buffer` encounters an invalid byte (like `0xFF` in 
UTF-8), it returns an error status (`APR_BADCH`) but consumes **0 bytes**.
   The previous loop logic exited on error, but without advancing the buffer 
pointer. If the caller (e.g., `SocketNode`) retries decoding the remaining 
buffer, it hits the same byte again indefinitely (100% CPU).
   
   **The Fix:**
   I updated the `decode` loop to detect when an error occurs without consuming 
input. In this case, it now:
   1.  Checks if it's just `APR_INCOMPLETE` (valid partial packet).
   2.  If not, manually advances the buffer position by 1 byte (skipping the 
bad byte).
   3.  Appends a Replacement Character (`?`) to the output.
   4.  Resets status to `APR_SUCCESS` to continue decoding the rest of the 
stream.


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