RockteMQ-AI commented on issue #10692:
URL: https://github.com/apache/rocketmq/issues/10692#issuecomment-5116231871

   **Issue Evaluation**
   
   Category: `type/bug` | Status: **Confirmed**
   
   The reported issue has been verified against the current codebase (upstream 
`develop` @ `00e45b8`).
   
   **Root Cause:** `HAProxyMessageForwarder.buildHAProxyMessage()` calls 
`Integer.parseInt()` on port values at 4 locations (lines 110, 116, 122, 126) 
without any exception handling. If a proxy protocol port attribute or channel 
address string contains a malformed (non-numeric) port value, a 
`NumberFormatException` is thrown, causing the entire HAProxy message 
construction to fail at runtime.
   
   **Impact:** Proxy module — HTTP/2 proxy HAProxy protocol forwarding. A 
malformed port in proxy protocol attributes or channel addresses will crash the 
forwarding path instead of gracefully degrading.
   
   **Severity:** medium — Triggered only by malformed input, but the code 
already has a pattern of returning `null` when required attributes are missing 
(e.g., empty attributes array at line 95). The fix should be consistent with 
this existing defensive pattern.
   
   **Suggested approach:**
   - Wrap the 4 `Integer.parseInt()` calls in a safe parsing helper that 
returns a sentinel value (e.g., `-1` or `0`) on failure.
   - Return `null` from `buildHAProxyMessage` when source or destination port 
cannot be parsed, consistent with the existing null-return pattern.
   - Add unit tests covering valid address parsing and malformed port values.
   
   An automated fix proposal can be generated. Reply `/approve` to proceed with 
PR generation.
   
   ---
   *Automated evaluation by RockteMQ-AI*


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