-
Notifications
You must be signed in to change notification settings - Fork 364
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
fix(gnovm): fix crash stack overflow when print value of self referencing structure #2851
base: master
Are you sure you want to change the base?
fix(gnovm): fix crash stack overflow when print value of self referencing structure #2851
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2851 +/- ##
==========================================
+ Coverage 60.92% 60.95% +0.02%
==========================================
Files 564 564
Lines 75267 75389 +122
==========================================
+ Hits 45854 45950 +96
- Misses 26041 26048 +7
- Partials 3372 3391 +19
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Ready for review ✅ |
if val, ok := seen[t]; ok { | ||
return val | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't know if this case will work ?
package main
import "fmt"
func main() {
t := struct {
Name string
Next interface{}
}{}
t.Next = &t
fmt.Printf("%v", t)
}
Fix stack overflow when printing value of recursive self referencing struct
resolve #2850
Methodology used
I added a stack to store the struct type already processed, then each time we process a struct i check if this struct type is already processed, if yes i remplace it by an empty struct so it avoid crash on recursive.
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description