hashstructure
hashstructure copied to clipboard
Cyclic reference causes stack overflow
Hi, I had found an issue that self-reference or cyclic-reference will lead to stack overflow. Here is an example:
package main
import "github.com/mitchellh/hashstructure/v2"
type Node struct {
Ptr *Node
}
func main() {
n := &Node{
Ptr: nil,
}
n.Ptr = n
hash, err := hashstructure.Hash(n, hashstructure.FormatV2, nil)
if err != nil {
panic(err)
}
println(hash)
}