Skip to content

Commit 573107b

Browse files
committed
Copy byte array when unmarshalling RawMessage
1 parent a209843 commit 573107b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

raw.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ func (v *RawMessage) UnmarshalEasyJSON(l *jlexer.Lexer) {
2525

2626
// UnmarshalJSON implements encoding/json.Unmarshaler interface.
2727
func (v *RawMessage) UnmarshalJSON(data []byte) error {
28-
*v = data
28+
*v = make([]byte, len(data))
29+
copy(*v, data)
2930
return nil
3031
}
3132

0 commit comments

Comments
 (0)