golang/go

x/crypto/argon2: panic if keyLen == 0

Open

#33,583 opened on Aug 11, 2019

View on GitHub
 (3 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
NeedsFixhelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

What version of Go are you using (go version)?

Does this issue reproduce with the latest release?

Assuming Playground uses the latest Go version, yes.

What operating system and processor architecture are you using (go env)?

What did you do?

https://play.golang.org/p/k07nWDYZ7Zk

What did you expect to see?

Should return empty byte slice

What did you see instead?

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0xffffffff addr=0x0 pc=0xab662]

goroutine 1 [running]:
golang.org/x/crypto/blake2b.(*digest).Write(0x0, 0x432240, 0x4, 0x40, 0x0, 0xf0520, 0x40c080, 0xce380)
	/tmp/gopath522840708/pkg/mod/golang.org/x/crypto@v0.0.0-20190701094942-4def268fd1a4/blake2b/blake2b.go:216 +0x22
golang.org/x/crypto/argon2.blake2bHash(0x15ee7c, 0x0, 0x0, 0x44e400, 0x400, 0x400)
	/tmp/gopath522840708/pkg/mod/golang.org/x/crypto@v0.0.0-20190701094942-4def268fd1a4/argon2/blake2b.go:26 +0xc0
golang.org/x/crypto/argon2.extractKey(0x800000, 0x10000, 0x10000, 0x10000, 0x4, 0x0, 0x1, 0x0, 0x0, 0x0)
	/tmp/gopath522840708/pkg/mod/golang.org/x/crypto@v0.0.0-20190701094942-4def268fd1a4/argon2/argon2.go:255 +0x2c0
golang.org/x/crypto/argon2.deriveKey(0x1, 0x414008, 0x1, 0x1, 0x414009, 0x1, 0x1, 0x0, 0x0, 0x0, ...)
	/tmp/gopath522840708/pkg/mod/golang.org/x/crypto@v0.0.0-20190701094942-4def268fd1a4/argon2/argon2.go:117 +0x2e0
golang.org/x/crypto/argon2.Key(...)
	/tmp/gopath522840708/pkg/mod/golang.org/x/crypto@v0.0.0-20190701094942-4def268fd1a4/argon2/argon2.go:75
main.main()
	/tmp/sandbox040143225/prog.go:9 +0x100

Contributor guide