From 8bd6bd63656d411729c450d452e1355b42adf900 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 2 Nov 2018 17:31:59 +0100 Subject: prog: allow escaping paths but don't generate them Filename generated escaping paths in the past. The reason for the check during validation is to wipe old program from corpuses. Now that they are hopefully wiped everywhere, we can relax the check to restrict only filename to not produce escaping paths, but allow existing programs with escaping paths. This is useful in particular if we generate syzkaller programs from strace output. --- prog/prog_test.go | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'prog/prog_test.go') diff --git a/prog/prog_test.go b/prog/prog_test.go index 29b4d385e..1bc9eb4d5 100644 --- a/prog/prog_test.go +++ b/prog/prog_test.go @@ -5,7 +5,6 @@ package prog import ( "bytes" - "encoding/hex" "fmt" "math/rand" "strings" @@ -229,18 +228,10 @@ func TestEscapingPaths(t *testing.T) { "./file": false, "./file/..": false, } - target, err := GetTarget("test", "64") - if err != nil { - t.Fatal(err) - } - for path, escaping := range paths { - text := fmt.Sprintf("mutate5(&(0x7f0000000000)=\"%s\", 0x0)", hex.EncodeToString([]byte(path))) - _, err := target.Deserialize([]byte(text)) - if !escaping && err != nil { - t.Errorf("path %q is detected as escaping (%v)", path, err) - } - if escaping && (err == nil || !strings.Contains(err.Error(), "sandbox escaping file")) { - t.Errorf("path %q is not detected as escaping (%v)", path, err) + for path, want := range paths { + got := escapingFilename(path) + if got != want { + t.Errorf("path %q: got %v, want %v", path, got, want) } } } -- cgit mrf-deployment