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

cycle struct cite cause stack over flow #23

Open
chenchu2014 opened this issue Jan 7, 2021 · 3 comments
Open

cycle struct cite cause stack over flow #23

chenchu2014 opened this issue Jan 7, 2021 · 3 comments

Comments

@chenchu2014
Copy link

type struct A {b *B}
type struct B {a *A}

will cause stack over flow, think of cycle cite check?

@andeya
Copy link
Member

andeya commented Jan 7, 2021

which func?

@chenchu2014
Copy link
Author

github.com/bytedance/[email protected]+incompatible/validator/default.go:16

@andeya
Copy link
Member

andeya commented Jan 14, 2021

But I can't reproduce it

type (
	Issue23A struct {
		b *Issue23B
		v int64 `vd:"$==0"`
	}
	Issue23B struct {
		a *Issue23A
		v int64 `vd:"$==0"`
	}
)

func TestIssue23(t *testing.T) {
	var data = &Issue23B{a: &Issue23A{b: new(Issue23B)}}
	err := vd.Validate(data)
	assert.NoError(t, err)
}
=== RUN   TestIssue23
--- PASS: TestIssue23 (0.00s)
PASS

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