aboutsummaryrefslogtreecommitdiffstats
path: root/prog/mutation.go
diff options
context:
space:
mode:
authorVeronica Radu <veronicaradu@google.com>2019-08-12 17:41:25 +0200
committerDmitry Vyukov <dvyukov@google.com>2019-09-03 16:30:45 +0200
commitdbd627eb61743340cb565ce41308beb4383a77be (patch)
tree065a277c6b4dd3bd2798b5cba36fe744c8027b42 /prog/mutation.go
parent8d48456885907439825fa265e0c375da5fdf1ecd (diff)
prog: add implementation for resource centric
Diffstat (limited to 'prog/mutation.go')
-rw-r--r--prog/mutation.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/prog/mutation.go b/prog/mutation.go
index a3ab17637..8a33c3e2e 100644
--- a/prog/mutation.go
+++ b/prog/mutation.go
@@ -112,7 +112,7 @@ func (ctx *mutator) squashAny() bool {
arg.data = mutateData(r, arg.Data(), 0, maxBlobLen)
// Update base pointer if size has increased.
if baseSize < base.Res.Size() {
- s := analyze(ctx.ct, p, p.Calls[0])
+ s := analyze(ctx.ct, ctx.corpus, p, p.Calls[0])
newArg := r.allocAddr(s, base.Type(), base.Res.Size(), base.Res)
*base = *newArg
}
@@ -131,8 +131,9 @@ func (ctx *mutator) insertCall() bool {
if idx < len(p.Calls) {
c = p.Calls[idx]
}
- s := analyze(ctx.ct, p, c)
+ s := analyze(ctx.ct, ctx.corpus, p, c)
calls := r.generateCall(s, p)
+ // TODO: the program might have more than ncalls
p.insertBefore(c, calls)
return true
}
@@ -158,7 +159,7 @@ func (ctx *mutator) mutateArg() bool {
if len(c.Args) == 0 {
return false
}
- s := analyze(ctx.ct, p, c)
+ s := analyze(ctx.ct, ctx.corpus, p, c)
updateSizes := true
for stop, ok := false, false; !stop; stop = ok && r.oneOf(3) {
ok = true