Skip to content

hash/maphash: don't discard data on random seed init #37328

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

Closed
wants to merge 2 commits into from

Conversation

vovapi
Copy link
Contributor

@vovapi vovapi commented Feb 20, 2020

Hash initializes seed on the first usage of seed or state with initSeed.
initSeed uses SetSeed which discards accumulated data.
This causes hash to return different sums for the same data in the first use
and after reset.
This CL fixes this issue by separating the seed set from data discard.

Fixes #37315

Hash initializes seed on the first usage of seed or state with initSeed.
initSeed uses SetSeed which discards accumulated data.
This causes hash to return different sums for the same data in the first use
and after reset.
This CL fixes this issue by separating the seed set from data discard.

Fixes golang#37315
@googlebot googlebot added the cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change. label Feb 20, 2020
@gopherbot
Copy link
Contributor

This PR (HEAD: 1d8b10d) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/220259 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Keith Randall:

Patch Set 1: Code-Review+2


Please don’t reply on this GitHub thread. Visit golang.org/cl/220259.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Dmitri Shuralyov:

Patch Set 1:

(1 comment)


Please don’t reply on this GitHub thread. Visit golang.org/cl/220259.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

This PR (HEAD: 48b2f96) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/go/+/220259 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off)
See the Wiki page for more info

@gopherbot
Copy link
Contributor

Message from Vladimir Evgrafov:

Patch Set 2:

(1 comment)

Thanks!


Please don’t reply on this GitHub thread. Visit golang.org/cl/220259.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Emmanuel Odeke:

Patch Set 2: Run-TryBot+1


Please don’t reply on this GitHub thread. Visit golang.org/cl/220259.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 2:

TryBots beginning. Status page: https://farmer.golang.org/try?commit=fe1a2b77


Please don’t reply on this GitHub thread. Visit golang.org/cl/220259.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Gobot Gobot:

Patch Set 2: TryBot-Result+1

TryBots are happy.


Please don’t reply on this GitHub thread. Visit golang.org/cl/220259.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Dmitri Shuralyov:

Patch Set 2:

Thank you for sending this fix Vladimir.

It has a +2 review from the package owner (Keith). If it's ready from your side, I can submit it for you now. Please let us know.


Please don’t reply on this GitHub thread. Visit golang.org/cl/220259.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Vladimir Evgrafov:

Patch Set 2:

If it's ready from your side, I can submit it for you now. Please let us know.
It's good to go. Will it be in go1.14 release?


Please don’t reply on this GitHub thread. Visit golang.org/cl/220259.
After addressing review feedback, remember to publish your drafts!

@gopherbot
Copy link
Contributor

Message from Dmitri Shuralyov:

Patch Set 2:

It's good to go.

Great, submitting.

Will it be in go1.14 release?

Yes. The bug it is fixing is in the Go 1.14 milestone. I'll cherry-pick this CL onto release-branch.go1.14 up next.


Please don’t reply on this GitHub thread. Visit golang.org/cl/220259.
After addressing review feedback, remember to publish your drafts!

gopherbot pushed a commit that referenced this pull request Feb 22, 2020
Hash initializes seed on the first usage of seed or state with initSeed.
initSeed uses SetSeed which discards accumulated data.
This causes hash to return different sums for the same data in the first use
and after reset.
This CL fixes this issue by separating the seed set from data discard.

Fixes #37315

Change-Id: Ic7020702c2ce822eb700af462e37efab12f72054
GitHub-Last-Rev: 48b2f96
GitHub-Pull-Request: #37328
Reviewed-on: https://go-review.googlesource.com/c/go/+/220259
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
@golang golang deleted a comment from gopherbot Feb 22, 2020
@golang golang deleted a comment from gopherbot Feb 22, 2020
@dmitshur
Copy link
Member

Closing because this PR has been merged via CL 220617 as commit 638df87.

gerritbot should've done this; we need to investigate why it didn't. See #35867 (comment).

@dmitshur dmitshur closed this Feb 22, 2020
gopherbot pushed a commit that referenced this pull request Feb 24, 2020
…ed init

Hash initializes seed on the first usage of seed or state with initSeed.
initSeed uses SetSeed which discards accumulated data.
This causes hash to return different sums for the same data in the first use
and after reset.
This CL fixes this issue by separating the seed set from data discard.

Updates #37315

Change-Id: Ic7020702c2ce822eb700af462e37efab12f72054
GitHub-Last-Rev: 48b2f96
GitHub-Pull-Request: #37328
Reviewed-on: https://go-review.googlesource.com/c/go/+/220259
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
(cherry picked from commit 638df87)
Reviewed-on: https://go-review.googlesource.com/c/go/+/220617
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Used by googlebot to label PRs as having a valid CLA. The text of this label should not change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hash/maphash: first call of the Reset method doesn't reset internal state
4 participants