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

Don't crash when freezing a struct with a circular reference #567

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

oprypin
Copy link
Member

@oprypin oprypin commented Nov 25, 2024

The Freeze method needs to check for a frozen condition just like all the other types of values, otherwise there can be infinite recursion.

The test that I'm adding here would crash without the fix.

The Freeze method needs to check for a `frozen` condition just like all the other types of values, otherwise there can be infinite recursion.

The test that I'm adding here would crash without the fix.
Copy link
Collaborator

@adonovan adonovan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I checked that no other Freeze implementations have this problem.

starlarkstruct/struct.go Show resolved Hide resolved
Copy link
Collaborator

@adonovan adonovan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again!

@adonovan adonovan merged commit c05ff20 into google:master Nov 25, 2024
13 checks passed
@oprypin oprypin deleted the structcirc branch November 25, 2024 20:48
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

Successfully merging this pull request may close these issues.

starlarkstruct Freeze() can cause a stack overflow if circular references are involved
2 participants