GCP: Reject invalid GCS buffered read ranges - #17961
Open
charliec05 wants to merge 2 commits into
Open
Conversation
Validate buffered read offsets and lengths instead of silently truncating out-of-bounds requests. Generated-by: Codex
Generated-by: Codex
Contributor
Author
|
Hi @szehon-ho, would you be willing to review this GCSInputStream contract fix? It rejects invalid buffered-read ranges instead of silently truncating them, includes boundary regression coverage, and all 42 CI checks pass. Thanks! |
uros-b
approved these changes
Sep 5, 2026
Member
|
+1, thank you @charliec05! Yes please ping @szehon-ho for additional review here |
Contributor
Author
|
Thanks for the review, @uros-b. @szehon-ho, could you take a look when you have time? The current revision has uros-b's approval and all 42 checks pass; there are no outstanding code-change requests. |
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.
Summary
offsetandlengthinGCSInputStream.read(byte[], int, int)Motivation
GCSInputStreamusedMath.minwhen setting the reusableByteBufferlimit. A request such as reading three bytes at offset two into a four-byte array was silently shortened to two bytes instead of throwingIndexOutOfBoundsExceptionas required by theInputStreamcontract.The existing EOF test also passed a length larger than its buffer; it now uses the buffer's actual length so it continues to exercise EOF with a valid range.
Testing
./gradlew :iceberg-gcp:spotlessApply :iceberg-gcp:testAI Disclosure