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

errors: do not report a unhandled error on hash.Hash.Write code which by contract WILL NEVER return an error #45

Closed
odeke-em opened this issue Sep 24, 2022 · 0 comments · Fixed by #49
Assignees
Labels
bug Something isn't working ux

Comments

@odeke-em
Copy link
Collaborator

odeke-em commented Sep 24, 2022

Summary

We've got reports for hashing algorithms not handling errors for example

[/Users/emmanuelodeke/go/src/github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1/secp256k1.go:160] - G104 (CWE-703): Errors unhandled. (Confidence: HIGH, Severity: LOW)
    159: 	hasherRIPEMD160 := ripemd160.New()
  > 160: 	hasherRIPEMD160.Write(sha[:]) // does not error
    161: 	return crypto.Address(hasherRIPEMD160.Sum(nil))

but the Go contracts for hash.Hash.Write say that it WILL NEVER return an error per https://pkg.go.dev/hash#Hash
Screen Shot 2022-09-23 at 6 48 28 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ux
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant