Change-Id: Ia96ddd520a7bd2fd53bff55315c6fac04ae96a2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/435282
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
// instrumentation is turned on.
import (
+ "bytes"
"crypto/md5"
"encoding/binary"
"fmt"
lit = 1
}
b.tmp = uleb128.AppendUleb128(b.tmp, lit)
- fd.encoded = make([]byte, len(b.tmp))
- copy(fd.encoded, b.tmp)
+ fd.encoded = bytes.Clone(b.tmp)
rv := uint(len(b.funcs))
b.funcs = append(b.funcs, fd)
return rv
package fuzz
import (
+ "bytes"
"context"
"crypto/sha256"
"errors"
warmup: c.warmupRun(),
}
if c.coverageMask != nil {
- input.coverageData = make([]byte, len(c.coverageMask))
- copy(input.coverageData, c.coverageMask)
+ input.coverageData = bytes.Clone(c.coverageMask)
}
if input.warmup {
// No fuzzing will occur, but it should count toward the limit set by
package fuzz
import (
+ "bytes"
"fmt"
"os"
"unsafe"
// valueCopy returns a copy of the value stored in shared memory.
func (m *sharedMem) valueCopy() []byte {
ref := m.valueRef()
- b := make([]byte, len(ref))
- copy(b, ref)
- return b
+ return bytes.Clone(ref)
}
// setValue copies the data in b into the shared memory buffer and sets