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

ByteBuffer: viewBytes should handle negative values #1082

Merged
merged 1 commit into from Jul 25, 2019

Conversation

weissi
Copy link
Member

@weissi weissi commented Jul 25, 2019

Motivation:

All ByteBuffer API that is used to parse potentially untrusted data
should be resilient against negative indices, offsets, and lenghts.
Unfortunately, ByteBuffer.viewBytes(at:length:) was not.

Modifications:

Make ByteBuffer.viewBytes(at:length:) resilient against negative values.

Result:

Fewer crashes.

Motivation:

All ByteBuffer API that is used to parse potentially untrusted data
should be resilient against negative indices, offsets, and lenghts.
Unfortunately, ByteBuffer.viewBytes(at:length:) was not.

Modifications:

Make ByteBuffer.viewBytes(at:length:) resilient against negative values.

Result:

Fewer crashes.
@weissi weissi added the patch-version-bump-only For PRs that when merged will only cause a bump of the patch version, ie. 1.0.x -> 1.0.(x+1) label Jul 25, 2019
@weissi weissi requested a review from Lukasa July 25, 2019 14:10
@Lukasa Lukasa modified the milestones: 2.5.1, 2.6.0 Jul 25, 2019
Copy link
Contributor

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@Lukasa Lukasa merged commit 96d9e44 into apple:master Jul 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch-version-bump-only For PRs that when merged will only cause a bump of the patch version, ie. 1.0.x -> 1.0.(x+1)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants