charliec05 opened a new pull request, #17961: URL: https://github.com/apache/iceberg/pull/17961
## Summary - validate `offset` and `length` in `GCSInputStream.read(byte[], int, int)` - stop silently truncating reads whose requested range exceeds the destination buffer - cover overflow, negative offset, and negative length cases ## Motivation `GCSInputStream` used `Math.min` when setting the reusable `ByteBuffer` limit. A request such as reading three bytes at offset two into a four-byte array was silently shortened to two bytes instead of throwing `IndexOutOfBoundsException` as required by the `InputStream` contract. 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:test` --- **AI Disclosure** - Model: GPT-5 (Codex) - Platform/Tool: OpenAI Codex - Human Oversight: fully reviewed - Prompt Summary: Used a detailed, repository-aware prompt to inspect buffered read contracts, reproduce silent range truncation, implement explicit validation, review the resulting diff, and run the complete affected module test suite. -- 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]
