aboutsummaryrefslogtreecommitdiffstats
path: root/prog/mutation.go
diff options
context:
space:
mode:
Diffstat (limited to 'prog/mutation.go')
-rw-r--r--prog/mutation.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/prog/mutation.go b/prog/mutation.go
index c9f647ae8..571b54a3f 100644
--- a/prog/mutation.go
+++ b/prog/mutation.go
@@ -344,14 +344,14 @@ func (t *BufferType) mutate(r *randGen, s *state, arg Arg, ctx ArgCtx) (calls []
data := append([]byte{}, a.Data()...)
a.data = mutateData(r, data, minLen, maxLen)
case BufferString:
- data := append([]byte{}, a.Data()...)
- if r.bin() {
+ if len(t.Values) != 0 {
+ a.data = r.randString(s, t)
+ } else {
if t.TypeSize != 0 {
minLen, maxLen = t.TypeSize, t.TypeSize
}
+ data := append([]byte{}, a.Data()...)
a.data = mutateData(r, data, minLen, maxLen)
- } else {
- a.data = r.randString(s, t)
}
case BufferFilename:
a.data = []byte(r.filename(s, t))
@@ -630,6 +630,10 @@ func (t *BufferType) getMutationPrio(target *Target, arg Arg, ignoreSpecial bool
if t.Dir() == DirOut && !t.Varlen() {
return dontMutate, false
}
+ if t.Kind == BufferString && len(t.Values) == 1 {
+ // These are effectively consts (and frequently file names).
+ return dontMutate, false
+ }
return 0.8 * maxPriority, false
}