Skip to content

Fix a crash in the Cronet integration when handling empty responses.#5719

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_943906033
Open

Fix a crash in the Cronet integration when handling empty responses.#5719
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_943906033

Conversation

@copybara-service

Copy link
Copy Markdown

Fix a crash in the Cronet integration when handling empty responses.

The logic in BufferQueue was incorrectly identifying identity/uncompressed
responses as compressed, and vice versa. Additionally, for empty responses
(Content-Length: 0), it could attempt to allocate a 0-capacity buffer, which
causes Cronet to throw an IllegalArgumentException ("ByteBuffer is already full").

This change:

  • Corrects the inverted logic (renaming isCompressed to isIdentity).
  • Ensures we always allocate a buffer of at least size 1 even for empty responses.

The logic in BufferQueue was incorrectly identifying identity/uncompressed
responses as compressed, and vice versa. Additionally, for empty responses
(Content-Length: 0), it could attempt to allocate a 0-capacity buffer, which
causes Cronet to throw an IllegalArgumentException ("ByteBuffer is already full").

This change:
- Corrects the inverted logic (renaming `isCompressed` to `isIdentity`).
- Ensures we always allocate a buffer of at least size 1 even for empty responses.

PiperOrigin-RevId: 943906033
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant