Skip to content

fix(broker): reject pop requests with non-positive maxMsgNums - #11144

Open
zjncs wants to merge 1 commit into
apache:developfrom
zjncs:fix/pop-max-msg-nums-bounds
Open

zjncs wants to merge 1 commit into
apache:developfrom
zjncs:fix/pop-max-msg-nums-bounds

Conversation

@zjncs

@zjncs zjncs commented Sep 11, 2026

Copy link
Copy Markdown

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

processRequest only validated maxMsgNums > 32. A request with 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.

Validate maxMsgNums >= 1 next to the existing upper-bound check.
Copilot AI lite review requested due to automatic review settings September 11, 2026 07:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Input validation fix: reject pop requests with non-positive maxMsgNums before processing. Simple guard clause with test coverage.

LGTM — clean defensive check.


Automated review by github-manager-bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants