aboutsummaryrefslogtreecommitdiffstats
path: root/prog/mutation.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-05-06 08:33:51 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-05-06 11:24:51 +0000
commit441f4fcc08ae33f36e5a15a9dd5abde3f0797921 (patch)
treeb85c0f6661d52d537e6e39b2791f0d7022390fec /prog/mutation.go
parent69f2eab004cdc5bce339d5359dcf234698153dc7 (diff)
prog: fix validation of DataMmapProg
Allow to serialize/deserialize DataMmapProg and fix validation in debug mode. Fixes #4750
Diffstat (limited to 'prog/mutation.go')
-rw-r--r--prog/mutation.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/prog/mutation.go b/prog/mutation.go
index 8547be3cc..c6cd3c7cf 100644
--- a/prog/mutation.go
+++ b/prog/mutation.go
@@ -55,6 +55,9 @@ func (o MutateOpts) weight() int {
func (p *Prog) MutateWithOpts(rs rand.Source, ncalls int, ct *ChoiceTable, noMutate map[int]bool,
corpus []*Prog, opts MutateOpts) {
+ if p.isUnsafe {
+ panic("mutation of unsafe programs is not supposed to be done")
+ }
totalWeight := opts.weight()
r := newRand(p.Target, rs)
if ncalls < len(p.Calls) {