huier5635-cmd opened a new pull request, #11488:
URL: https://github.com/apache/rocketmq/pull/11488

   ### Which Issue(s) This PR Fixes
   
   No existing issue is linked; the regression tests below reproduce the defect 
against `develop`.
   
   ### Brief Description
   
   `MessageDecoder.countInnerMsgNum` advances the buffer by the encoded record 
size. A zero size leaves the position unchanged and the loop never terminates. 
The broker calls this method when processing an inner batch for a BatchCQ topic.
   
   Validate that a size field is present, the record includes the 22-byte 
encoded header, and the record fits within the remaining buffer before 
advancing and counting it. Return `MESSAGE_ILLEGAL` for malformed or empty 
inner batches before invoking storage.
   
   Regression tests cover stalled and invalid record lengths, a malformed 
following record, valid encoded batches with direct/read-only buffers and 
nonzero positions, and the actual broker rejection/storage paths. Valid batches 
retain their body, message count, flags, and successful response.
   
   ### How Did You Test This Change?
   
   Validated against Apache commit `38a7ca0d23a3e2d4339f9a2bf6e78cf541eed9e3`, 
including recursive submodules, on Ubuntu 24.04 with Corretto JDK 8 and Maven 
3.10.0. Maven's default Checkstyle and JaCoCo configuration remained enabled.
   
   - Original broker reactor build/install passed: `mvn -B -ntp -pl broker -am 
-DskipTests install`.
   - With only the new tests applied, the zero-length decoder and broker tests 
timed out as expected; both valid-message controls passed against the original 
code.
   - With the complete fix applied, `mvn -B -ntp -pl broker -am 
-Dtest=MessageDecoderTest,SendMessageProcessorTest 
-Dsurefire.failIfNoSpecifiedTests=false test` passed all 30 tests in the two 
related classes, with no skips.
   - `mvn -B -ntp -pl common test` passed all 271 tests, with no skips.
   - Strict patch application, `git diff --check`, and verification of the four 
final source-file hashes passed.
   
   [Reproducible validation run and raw XML/log 
artifact](https://github.com/huier5635-cmd/agentUniverse/actions/runs/39856142195).
 The validation workflow checks out and tests the Apache sources; it is not 
part of this PR. The full broker suite and a live broker cluster were not run.
   


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