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

hash/crc32: should document that tables returned by MakeTable should not be modified #12487

Closed
dsnet opened this issue Sep 3, 2015 · 1 comment

Comments

@dsnet
Copy link
Member

dsnet commented Sep 3, 2015

Was playing around manually modifying the Table in one package and was surprised to find out that it causes CRC32 errors in another package.

The name MakeTable seems to indicate that a unique table will be created and returned. But for the IEEE and Castagnoli polynomials specifically, it returns a reference to tables held globally. This has the following consequences:

See https://play.golang.org/p/IWehs0lQAc

@gopherbot
Copy link

CL https://golang.org/cl/14258 mentions this issue.

ianlancetaylor pushed a commit that referenced this issue Sep 4, 2015
Explicitly say that *Table returned by MakeTable may not be
modified. Otherwise, this leads to very subtle bugs that may
or may not manifest themselves.

Same comment was made on package crc64, to keep the future
open to the caching tables that crc32 effectively does.

Fixes: #12487.

Change-Id: I2881bebb8b16f6f8564412172774c79c2593c6c1
Reviewed-on: https://go-review.googlesource.com/14258
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@dsnet dsnet closed this as completed Sep 4, 2015
@golang golang locked and limited conversation to collaborators Sep 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants