zmuxuny opened a new pull request, #11218:
URL: https://github.com/apache/rocketmq/pull/11218

   ### Which Issue(s) This PR Fixes
   
   - Fixes #10832
   
   ### Brief Description
   
   `RemotingCommand.decode` reads its four-byte header marker without checking 
the remaining buffer and passes an unknown serialization code into 
`headerDecode`. A truncated frame then raises an unchecked buffer exception; an 
unknown code raises `NullPointerException`. The decoder's public contract 
declares `RemotingCommandException`, and direct callers such as the controller 
state-machine replay handle that checked exception.
   
   Validate the marker length and serialization type before decoding the 
header. Valid JSON and RocketMQ frames keep the existing path. This continues 
the unmerged #10842 attempt on the current `develop` branch.
   
   ### How Did You Test This Change?
   
   - Added tests for marker lengths 0–3 bytes and unknown serialization code 
127. The unknown-code test failed with `NullPointerException` before the fix.
   - Ran `JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 
PATH=/usr/lib/jvm/java-11-openjdk-amd64/bin:$PATH mvn -B -ntp -pl remoting -am 
-Dtest=RemotingCommandTest -Dsurefire.failIfNoSpecifiedTests=false test`: 14 
tests passed; Checkstyle and SpotBugs passed in the Maven lifecycle.
   


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