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

strutil: fix MatchCounter to also work with buffer reuse #5744

Merged
merged 1 commit into from Aug 31, 2018

Conversation

chipaca
Copy link
Contributor

@chipaca chipaca commented Aug 30, 2018

strutil.MatchCounter had a bug where, if the caller reused the []byte in
later calls, the contents of a (supposedly) internal buffer got overwritten.

This fixes that by switching to copying it to a bytes.Buffer. We could also
instead do the accounting ourselves but that seems like too much fiddly work.

`strutil.MatchCounter` had a bug where, if the caller reused the `[]byte` in
later calls, the contents of a (supposedly) internal buffer got overwritten.

This fixes that by switching to copying it to a bytes.Buffer. We could also
instead do the accounting ourselves but that seems like too much fiddly work.
Copy link
Collaborator

@zyga zyga left a comment

Choose a reason for hiding this comment

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

Looks allright

@mvo5 mvo5 merged commit 6bcf9e7 into snapcore:master Aug 31, 2018
@chipaca chipaca deleted the matchcounter-bugz branch September 10, 2018 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants