jojochuang commented on PR #12046: URL: https://github.com/apache/ozone/pull/12046#issuecomment-6868528077
## Off-by-one at exact block boundary (separate from empty-block fix) Copilot’s note is correct: in `checksumBlocks()`, the early exit uses `currentLength > getLength()`. When the requested length equals the sum of blocks already collected (e.g. blocks **1000 + 700** bytes, request **length = 1000**), the loop still checksums the second block because `1000 > 1000` is false. **Suggested fix:** use `currentLength >= getLength()` before processing the next block, and add a regression test (e.g. `testCompositeCrcStopsAtExactBlockBoundary`: `length == firstBlock.length` with two blocks). `testCompositeCrcIgnoresBlocksBeyondRequestedLength` only covers `length = 500` (mid-first-block vs stop before second block), not this edge. A patch with that change and test is on [jojochuang/ozone `HDDS-16834-checksum-length-boundary`](https://github.com/jojochuang/ozone/tree/HDDS-16834-checksum-length-boundary) for the author to cherry-pick if desired. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
