Skip to content

Commit d48874a

Browse files
authored
Merge pull request #381 from niallnsec/master
Copy byte array when unmarshalling RawMessage
2 parents 141f9c7 + 34d2f3a commit d48874a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

bootstrap/bootstrap.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,10 @@ func (g *Generator) Run() error {
187187
buildFlags := buildFlagsRegexp.FindAllString(g.GenBuildFlags, -1)
188188
execArgs = append(execArgs, buildFlags...)
189189
}
190-
execArgs = append(execArgs, "-tags", g.BuildTags, filepath.Base(path))
190+
if len(g.BuildTags) > 0 {
191+
execArgs = append(execArgs, "-tags", g.BuildTags)
192+
}
193+
execArgs = append(execArgs, filepath.Base(path))
191194
cmd := exec.Command("go", execArgs...)
192195

193196
cmd.Stdout = f

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)