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

s2: Fix "better" out of bounds read. #291

Merged
merged 1 commit into from
Oct 28, 2020
Merged

Conversation

klauspost
Copy link
Owner

Fixes #290

@klauspost
Copy link
Owner Author

Travis seems to have broken its integration again: https://travis-ci.org/github/klauspost/compress/builds/739402780

@greatroar
Copy link
Contributor

Fix confirmed.

@@ -131,7 +145,7 @@ func TestEncoderRegression(t *testing.T) {
t.Error(err)
return
}
test(t, b)
test(t, b[:len(b):len(b)])
Copy link
Contributor

Choose a reason for hiding this comment

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

Might it be a good idea to restrict the capacity of src in EncodeBetter, too? (And maybe other places?)

Copy link
Owner Author

Choose a reason for hiding this comment

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

@greatroar That is exactly what this is doing. The test function tests both Encode and EncodeBetter using the data.

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean in the actual code, not in the test.

@klauspost
Copy link
Owner Author

Fix confirmed.

Great. I will wait until CI has finished and I also have started fuzz testing. If both are fine I will merge and release.

@klauspost klauspost merged commit 456984a into master Oct 28, 2020
@klauspost klauspost deleted the fix-better-out-of-bounds branch October 28, 2020 07:50
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.

s2.EncodeBetter reads out of bounds and panics
2 participants