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

[ms-go1.23-support] Error out when encoding hash objects not implemented by the built-in providers #212

Merged
merged 2 commits into from
Nov 11, 2024

Conversation

qmuntal
Copy link
Collaborator

@qmuntal qmuntal commented Nov 4, 2024

This is a partial backport of #161 to the ms-go1.23-support branch.

We shouldn't read arbitrary memory and return it to the caller unless we know what we are decoding. This PR makes calls to MarshalBinary and UnmarshalBinary on hash objects to return an error when not using the built-in providers instead of attempting to marshal and unmarshal arbitrary memory, which normally end up in a panic while decoding the object.

Note that in #161 we went a little further and made the NewSHAX functions return an object that doesn't implement the encoding interfaces when not using the built-in providers. That change is too big to be backported.

@qmuntal qmuntal changed the title Error out when encoding hash objects not implemented by the built-in providers [ms-go1.23-support] Error out when encoding hash objects not implemented by the built-in providers Nov 4, 2024
@qmuntal qmuntal force-pushed the ms-go1.23-hashmshl branch from a197832 to 2281bf3 Compare November 4, 2024 15:32
@qmuntal
Copy link
Collaborator Author

qmuntal commented Nov 4, 2024

macOS runners are failing because just today there is a scheduled burnout. See #213.

hash_test.go Show resolved Hide resolved
hash_test.go Show resolved Hide resolved
@qmuntal qmuntal merged commit 23b90e6 into ms-go1.23-support Nov 11, 2024
20 checks passed
@qmuntal qmuntal deleted the ms-go1.23-hashmshl branch November 11, 2024 08:31
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.

2 participants