AmarGhugare opened a new pull request, #932: URL: https://github.com/apache/commons-io/pull/932
`CharSequenceReader.skip(long)` adds the requested count to its position before clamping it. Large counts can overflow, return a negative skip count, and move the reader backward. After reading `ab` from `abc`, `skip(Long.MAX_VALUE)` returns `-1` and leaves `b` next, instead of skipping the remaining character and reaching EOF. A nonzero constructor start position can trigger the same problem. Clamp the requested count to the remaining length before advancing the index. This follows the existing approach in `UnsynchronizedByteArrayInputStream.skip(long)` and changes no public API. Add 12 cases for large counts, nonzero starts, bounded subsequences, mark/reset, EOF, and mutable sequence lengths. Six cases fail on both the original source and the released 2.22.0 JAR; all cases pass after the fix. ## Validation JDK 17, Maven 3.10.0, targeting Java 8: - All 23 `CharSequenceReaderTest` cases passed under Maven, including the existing serialization compatibility test. - Ran the unfiltered default `mvn -B -ntp` build: 7,431 tests, zero assertion failures, seven errors, 64 skips. The seven errors are Windows symlink-privilege errors in `PathUtilsCopyTest` and `FileUtilsTest`. The same failing cases were previously reproduced with unchanged upstream production source. The full default Windows build is not green locally. - Coverage, license, API compatibility, Checkstyle, SpotBugs, PMD, and Javadoc checks passed. Completed the remaining checks without repeating tests: ```text mvn -B -ntp -DskipTests -DskipITs verify apache-rat:check japicmp:cmp checkstyle:check spotbugs:check pmd:check javadoc:javadoc ``` A Jira ticket has not yet been filed for this defect. ## Checklist - [x] Read the contribution guidelines. - [x] Added regression tests that fail before the runtime fix. - [x] Passed coverage, license, compatibility, style, static-analysis, and Javadoc checks. - [ ] Successful unfiltered default Maven build on Windows; baseline privilege errors are described above. - [x] Explained the change and kept the commit focused. -- 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]
