Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Cyclic reference causes stack overflow #46

Open
ccbhj opened this issue Mar 19, 2024 · 0 comments
Open

Cyclic reference causes stack overflow #46

ccbhj opened this issue Mar 19, 2024 · 0 comments

Comments

@ccbhj
Copy link

ccbhj commented Mar 19, 2024

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)
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant