aboutsummaryrefslogtreecommitdiffstats
path: root/prog/encoding.go
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2017-07-31 19:48:42 +0200
committerAndrey Konovalov <andreyknvl@google.com>2017-08-01 19:19:05 +0200
commit1517bd95488be386712ddab269ffd1dc1cf37f86 (patch)
treea8728b288db3d9511e248360d2252611ffce72d8 /prog/encoding.go
parent890882a0cf6eeecb32ec0d79cff56660f573b8c9 (diff)
prog: generate missing syscall args when decoding
After a change in syscall description the number of syscall arguments might change and some of the programs in corpus get invalidated. This change makes syzkaller to generate missing arguments when decoding a program as an attempt to fix and keep more programs from corpus.
Diffstat (limited to 'prog/encoding.go')
-rw-r--r--prog/encoding.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/prog/encoding.go b/prog/encoding.go
index c9d5d40c5..69fcdc6cb 100644
--- a/prog/encoding.go
+++ b/prog/encoding.go
@@ -171,6 +171,11 @@ func Deserialize(data []byte) (prog *Prog, err error) {
if !p.EOF() {
return nil, fmt.Errorf("tailing data (line #%v)", p.l)
}
+ if len(c.Args) < len(meta.Args) {
+ for i := len(c.Args); i < len(meta.Args); i++ {
+ c.Args = append(c.Args, defaultArg(meta.Args[i]))
+ }
+ }
if len(c.Args) != len(meta.Args) {
return nil, fmt.Errorf("wrong call arg count: %v, want %v", len(c.Args), len(meta.Args))
}