diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-07-31 20:38:33 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-07-31 20:38:33 +0200 |
| commit | 8ef497b65213b43164bcb9437d0c5bdd986cd52c (patch) | |
| tree | 208ea3781036be15fb3d7a01ee01ee7aaecdbd3a /pkg/ifuzz | |
| parent | ba6c552acdce01730ee9d3601702a7614ca1a021 (diff) | |
gometalinter: clean up vetshadow
This just cleans up existing warnings.
vetshadow is not enabled yet because it crashes.
Update #538
Diffstat (limited to 'pkg/ifuzz')
| -rw-r--r-- | pkg/ifuzz/ifuzz.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/pkg/ifuzz/ifuzz.go b/pkg/ifuzz/ifuzz.go index 985aa3501..2d51e0340 100644 --- a/pkg/ifuzz/ifuzz.go +++ b/pkg/ifuzz/ifuzz.go @@ -158,23 +158,23 @@ func Mutate(cfg *Config, r *rand.Rand, text []byte) []byte { switch x := r.Intn(100); { case x < 5 && len(text1) != 0: // delete byte - i := r.Intn(len(text1)) - copy(text1[i:], text1[i+1:]) + pos := r.Intn(len(text1)) + copy(text1[pos:], text1[pos+1:]) text1 = text1[:len(text1)-1] case x < 40 && len(text1) != 0: // replace a byte - i := r.Intn(len(text1)) - text1[i] = byte(r.Intn(256)) + pos := r.Intn(len(text1)) + text1[pos] = byte(r.Intn(256)) case x < 70 && len(text1) != 0: // flip a bit - i := r.Intn(len(text1)) - text1[i] ^= 1 << byte(r.Intn(8)) + pos := r.Intn(len(text1)) + text1[pos] ^= 1 << byte(r.Intn(8)) default: // insert a byte - i := r.Intn(len(text1) + 1) + pos := r.Intn(len(text1) + 1) text1 = append(text1, 0) - copy(text1[i+1:], text1[i:]) - text1[i] = byte(r.Intn(256)) + copy(text1[pos+1:], text1[pos:]) + text1[pos] = byte(r.Intn(256)) } } insns[i] = text1 |
