Skip to content

Conversation

goccy
Copy link
Owner

@goccy goccy commented Sep 1, 2021

fix #285

If encodes of empty struct value from interface type, go-json's compiler produces OpStructHead - OpStructEnd - OpInterfaceEnd operations. In this case, OpStructHead's next operation ( OpStructEnd ) 's index is equal OpInterfaceEnd's index. So, when vm evaluated OpStructHead operation, stored value was overwritten.
Therefore, I fixed this behavior by added index number for OpStructEnd 's next operation .

@goccy goccy merged commit 3fc3993 into master Sep 1, 2021
@goccy goccy deleted the feature/fix-empty-struct-interface branch September 1, 2021 02:57
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.

Panic when putting a struct in the array of interface{}
1 participant