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

   ### Motivation
   
   `processRequest` only validated `maxMsgNums > 32`. A request with 
`maxMsgNums = 0` fell through to the polling logic with a zero message budget 
instead of being rejected, and a negative value made `new GetMessageResult` 
pass the negative size to `new ArrayList`, throwing `IllegalArgumentException` 
from deep inside the pop path instead of a clean `INVALID_PARAMETER` response.
   
   ### Modifications
   
   Validate `maxMsgNums >= 1` next to the existing upper-bound check.
   
   ### Verification
   
   Fail-before (new test, run against the unpatched code):
   
   ```
   PopMessageProcessorTest#testProcessRequest_IllegalMaxMsgNums
   java.lang.NullPointerException: Cannot invoke 
"MessageStoreConfig.isTimerWheelEnable()" because
   "MessageStore.getMessageStoreConfig()" is null -- 
PopMessageProcessorTest.testProcessRequest_IllegalMaxMsgNums:261
   (the maxMsgNums=0 request was not rejected and fell through into the polling 
path)
   ```
   
   Pass-after:
   
   ```
   Tests run: 9, Failures: 0, Errors: 0, Skipped: 0 -- PopMessageProcessorTest
   ```
   


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