Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid index out of bounds with Http/2 settings id in the experimental range #3377

Merged
merged 1 commit into from
Jun 5, 2017

Conversation

ericgribkoff
Copy link
Contributor

Currently HTTP/2 setting ids in the designated experimental range, #f000 to #ffff, cause an index-out-of-bounds exception when consumed by Http2Reader#readSettings, as readShort() interprets the bytes as negative integers. This expands the out-of-bounds check in Settings#set to check for a negative index. Without the code change, the added test fails, demonstrating the bug.

I'm not fully familiar with OkHttp internals to know if this is the best approach for the fix, but it seemed better to add a PR with a repro case than just opening an issue. This popped up in gRPC Java (grpc/grpc-java#3032), and extends the earlier fix from #2299.

@ericgribkoff ericgribkoff changed the title Avoid NPE with Http/2 settings id in the experimental range Avoid index out of bounds with Http/2 settings id in the experimental range May 25, 2017
@swankjesse
Copy link
Collaborator

Thanks!

@swankjesse swankjesse merged commit 7f053b0 into square:master Jun 5, 2017
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.

2 participants