Aias00 opened a new issue, #10776:
URL: https://github.com/apache/rocketmq/issues/10776

   ### Before Creating the Bug Report
   
   - [x] I have searched the existing issues and pull requests.
   
   ### Runtime platform environment
   
   N/A
   
   ### RocketMQ version
   
   develop branch
   
   ### JDK Version
   
   N/A
   
   ### Describe the Bug
   
   `Http2ProtocolProxyHandler.match(ByteBuf in)` calls 
`in.getInt(in.readerIndex())` directly after checking 
`enableRemotingLocalProxyGrpc`.
   
   If the protocol detector receives an empty or short buffer with fewer than 4 
readable bytes, Netty can throw `IndexOutOfBoundsException` instead of 
returning `false` and letting the protocol detection pipeline wait for more 
data or reject the message safely.
   
   ### Steps to Reproduce
   
   1. Enable remoting local proxy gRPC protocol detection.
   2. Call `Http2ProtocolProxyHandler.match()` with a `ByteBuf` containing 
fewer than 4 readable bytes.
   3. Observe that `getInt(readerIndex)` can throw because the handler does not 
check `readableBytes()` first.
   
   ### What Did You Expect to See?
   
   Short buffers should not crash protocol detection. `match()` should return 
`false` until enough bytes are available to compare the HTTP/2 `PRI ` prefix.
   
   ### What Did You See Instead?
   
   `match()` can throw `IndexOutOfBoundsException` for short buffers.
   
   ### Additional Context
   
   This is in the Proxy remoting/gRPC ingress path and is a small runtime 
robustness fix.
   


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