{{ message }}
Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What is the purpose of the change?
Fixes #16520
UnsafeByteArrayInputStream.skip(long)can overflow itsmPosition + lenbounds check for a large positive count after the cursor has advanced. For example, after reading one byte of a slice,skip(Long.MAX_VALUE)reportsLong.MAX_VALUErather 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
UnsafeByteArrayInputStreamTestinvocations and all 48 I/O-package tests pass, with no failures, errors or skips. The Maven lifecycle Spotless check andgit diff --checkpass. This is focused module verification; full-repository and production-network testing were not run.Validation checklist
Investigation and patch preparation were AI-assisted; the stated local tests were actually executed.