hickey-ai opened a new pull request, #16523:
URL: https://github.com/apache/dubbo/pull/16523

   ## What is the purpose of the change?
   
   Fixes #16520
   
   `UnsafeByteArrayInputStream.skip(long)` can overflow its `mPosition + len` 
bounds check for a large positive count after the cursor has advanced. For 
example, after reading one byte of a slice, `skip(Long.MAX_VALUE)` reports 
`Long.MAX_VALUE` rather than the remaining byte count and can move the cursor 
backwards. The same request at EOF can make already-consumed bytes readable 
again.
   
   Compare the requested count with the remaining bytes before updating the 
cursor. This keeps skipping bounded to the current slice and preserves 
zero/negative skips, EOF, and mark/reset behavior.
   
   Regression coverage includes `Long.MAX_VALUE`, `Long.MAX_VALUE - 1`, a large 
non-overflowing control, a nonzero slice offset, EOF, mark/reset, and 
nonpositive counts. Three regression invocations fail against the unmodified 
source and pass with the fix.
   
   Validation on OpenJDK 21 (the project compiles with release 8): all 13 
`UnsafeByteArrayInputStreamTest` invocations and all 48 I/O-package tests pass, 
with no failures, errors or skips. The Maven lifecycle Spotless check and `git 
diff --check` pass. This is focused module verification; full-repository and 
production-network testing were not run.
   
   ## Validation checklist
   
   - [x] Linked reproducible GitHub issue.
   - [x] Description explains the trigger, expected behavior and minimal fix.
   - [x] Regression tests executed locally; failures reproduced before the 
change.
   - [ ] GitHub Actions: pending the newly submitted PR.
   
   Investigation and patch preparation were AI-assisted; the stated local tests 
were actually executed.
   


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

Reply via email to