Skip to content

Commit

Permalink
fix(#2035): Prevent infinite loops caused by cyclic references on typ…
Browse files Browse the repository at this point in the history
…edValue
  • Loading branch information
omarsy committed May 4, 2024
1 parent 88b9aa3 commit 79fbaf3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gnovm/pkg/gnolang/values_string.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ func (tv *TypedValue) ProtectedSprint(seen *seenValues, considerDeclaredType boo
return fmt.Sprintf("%p", tv)
}

seen.Put(tv.V)
defer seen.Pop()

// print declared type
if _, ok := tv.T.(*DeclaredType); ok && considerDeclaredType {
return tv.ProtectedString(seen)
Expand Down

0 comments on commit 79fbaf3

Please sign in to comment.