aboutsummaryrefslogtreecommitdiffstats
path: root/prog/clone.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/clone.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/clone.go')
-rw-r--r--prog/clone.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/prog/clone.go b/prog/clone.go
index 6ec28e39e..d41f3c13c 100644
--- a/prog/clone.go
+++ b/prog/clone.go
@@ -12,6 +12,14 @@ func (p *Prog) Clone() *Prog {
}
func (p *Prog) cloneWithMap(newargs map[*ResultArg]*ResultArg) *Prog {
+ if p.isUnsafe {
+ // We could clone it, but since we prohibit mutation
+ // of unsafe programs, it's unclear why we would clone it.
+ // Note: this also covers cloning of corpus programs
+ // during mutation, so if this is removed, we may need
+ // additional checks during mutation.
+ panic("cloning of unsafe programs is not supposed to be done")
+ }
p1 := &Prog{
Target: p.Target,
Calls: cloneCalls(p.Calls, newargs),