From 441f4fcc08ae33f36e5a15a9dd5abde3f0797921 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 6 May 2024 08:33:51 +0200 Subject: prog: fix validation of DataMmapProg Allow to serialize/deserialize DataMmapProg and fix validation in debug mode. Fixes #4750 --- prog/clone.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'prog/clone.go') 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), -- cgit mrf-deployment