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

   ### Which Issue(s) This PR Fixes
   
   - Fixes #10829
   
   ### Brief Description
   
   `MQVersion.getVersionDesc` and `value2Version` already clamp versions above 
the known range, but a negative value indexes `VERSION_VALUES` and throws 
`ArrayIndexOutOfBoundsException`. Version integers can come from remote client 
metadata, and these conversion methods are used by NameServer, Proxy, and 
command paths.
   
   Clamp negative versions to the earliest known version. Make `getVersionDesc` 
call `value2Version` so both representations always apply the same bounds. This 
continues the unmerged attempt in #10839 on the current `develop` branch.
   
   ### How Did You Test This Change?
   
   - Added a regression test for `-1` and `Integer.MIN_VALUE` through both 
methods. It failed with `ArrayIndexOutOfBoundsException` 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 common -am 
-Dtest=MQVersionTest -Dsurefire.failIfNoSpecifiedTests=false test`: 5 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