Skip to content

Conversation

@RanVaknin
Copy link
Contributor

This PR fixes #3538 where reading empty S3 objects with synchronous ResponseTransformer.toInputStream() returned incorrect data instead of EOF.

When retrieving an empty S3 object using the synchronous getObject() method with toInputStream(), the first call to read() incorrectly returned 212 (the first byte of the MD5 checksum of the empty payload) instead of -1 (EOF). This was likely an edge case that we didn't cover.

The fix was to add short circuit handling for empty objects in S3ChecksumValidatingInputStream.read() that validates the checksum and then returns -1 to signal EOF.

Added additional test coverage for the read(byte[]) method and also the async path (both work correctly)

@RanVaknin RanVaknin requested a review from a team as a code owner December 16, 2025 00:58
@RanVaknin RanVaknin added the no-api-surface-area-change Indicate there is no API surface area change and thus API surface area review is not required label Dec 16, 2025
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-api-surface-area-change Indicate there is no API surface area change and thus API surface area review is not required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid data returned from "InputStream.read()" on an empty S3 Object

1 participant