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

poseidon.Sum(nil) panics #64

Open
olegrok opened this issue Jul 4, 2024 · 0 comments
Open

poseidon.Sum(nil) panics #64

olegrok opened this issue Jul 4, 2024 · 0 comments
Assignees

Comments

@olegrok
Copy link

olegrok commented Jul 4, 2024

Code is following

package common

import (
	"testing"
	"github.com/iden3/go-iden3-crypto/poseidon"
)

func TestHashNil(t *testing.T) {
	t.Parallel()

	poseidon.Sum(nil)
}
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x5681f7]

goroutine 8 [running]:
testing.tRunner.func1.2({0x5d5880, 0x918290})
	/snap/go/10630/src/testing/testing.go:1631 +0x24a
testing.tRunner.func1()
	/snap/go/10630/src/testing/testing.go:1634 +0x377
panic({0x5d5880?, 0x918290?})
	/snap/go/10630/src/runtime/panic.go:770 +0x132
math/big.(*Int).Bytes(0x0)
	/snap/go/10630/src/math/big/int.go:527 +0x17
github.com/iden3/go-iden3-crypto/poseidon.(*hasher).Sum(0xb?, {0x0, 0x0, 0x0})
	/vendor/github.com/iden3/go-iden3-crypto/poseidon/poseidon_wrapper.go:44 +0x73
github.com/iden3/go-iden3-crypto/poseidon.Sum({0x0, 0x0, 0x0})
	/vendor/github.com/iden3/go-iden3-crypto/poseidon/poseidon_wrapper.go:19 +0xa3
github.com/NilFoundation/nil/common.TestHashNil(0xc000151040)
	/common/hash_test.go:34 +0x25
testing.tRunner(0xc000151040, 0x7971a8)
	/snap/go/10630/src/testing/testing.go:1689 +0xfb
created by testing.(*T).Run in goroutine 1
	/snap/go/10630/src/testing/testing.go:1742 +0x390
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

No branches or pull requests

2 participants