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

Cyclic reference causes stack overflow #46

@ccbhj

Description

@ccbhj

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)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions