aboutsummaryrefslogtreecommitdiffstats
path: root/prog/encoding.go
diff options
context:
space:
mode:
Diffstat (limited to 'prog/encoding.go')
-rw-r--r--prog/encoding.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/prog/encoding.go b/prog/encoding.go
index b5d5114ca..e925e7918 100644
--- a/prog/encoding.go
+++ b/prog/encoding.go
@@ -257,9 +257,13 @@ func (target *Target) Deserialize(data []byte, mode DeserializeMode) (*Prog, err
// This validation is done even in non-debug mode because deserialization
// procedure does not catch all bugs (e.g. mismatched types).
// And we can receive bad programs from corpus and hub.
- if err := prog.validate(); err != nil {
+ if err := prog.validateWithOpts(validationOptions{
+ // Don't validate auto-set conditional fields. We'll patch them later.
+ ignoreTransient: true,
+ }); err != nil {
return nil, err
}
+ p.fixupConditionals(prog)
if p.autos != nil {
p.fixupAutos(prog)
}
@@ -1154,6 +1158,13 @@ func (p *parser) fixupAutos(prog *Prog) {
}
}
+func (p *parser) fixupConditionals(prog *Prog) {
+ for _, c := range prog.Calls {
+ // Only overwrite transient union fields.
+ c.setDefaultConditions(p.target, true)
+ }
+}
+
func (p *parser) Scan() bool {
if p.e != nil || len(p.data) == 0 {
return false