Skip to content

Commit 17478af

Browse files
wildarchconnorkuehl
authored andcommitted
Fix infinite recursion in simpleunion marshalling.
The previous implementation would pass the original value into a map, which when marshalled would invoke the same function again, eventually exhausting the stack.
1 parent 919b80a commit 17478af

File tree

2 files changed

+45
-45
lines changed

2 files changed

+45
-45
lines changed

internal/qmp-gen/templates/simpleunion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func ({{ $subname }}) is{{ $basename }}() {}
3939
func (s {{ $subname }}) MarshalJSON() ([]byte, error) {
4040
v := map[string]interface{}{
4141
"type": "{{ $suffix }}",
42-
"data": s,
42+
"data": {{ $type.Go }} (s),
4343
}
4444
return json.Marshal(v)
4545
}

0 commit comments

Comments
 (0)