aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2016-11-24 20:20:05 +0100
committerDmitry Vyukov <dvyukov@google.com>2016-11-24 20:20:05 +0100
commit4de5c7eb202af06a9b0f4d746ec2d4f474668a57 (patch)
tree04b7bf77f7474d69c645972815aa6b905114997b
parent3356f68f1a531e194f6fbca5eb02f4f5bc4c218f (diff)
prog: fix pointer direction validation
Currently the added test description leads to crashes: --- FAIL: TestMinimizeRandom (0.12s) prog_test.go:20: seed=1480014002950172453 panic: syscall syz_test$regression0: pointer arg 'f0' has output direction [recovered] panic: syscall syz_test$regression0: pointer arg 'f0' has output direction The description is OK. Fix that.
-rw-r--r--prog/validation.go2
-rw-r--r--sys/test.txt8
2 files changed, 9 insertions, 1 deletions
diff --git a/prog/validation.go b/prog/validation.go
index c30e2eecd..4ef514490 100644
--- a/prog/validation.go
+++ b/prog/validation.go
@@ -117,7 +117,7 @@ func (c *Call) validate(ctx *validCtx) error {
return fmt.Errorf("syscall %v: vma arg '%v' has size 0", c.Meta.Name, typ.Name())
}
case *sys.PtrType:
- if arg.Type.Dir() != sys.DirIn {
+ if arg.Type.Dir() == sys.DirOut {
return fmt.Errorf("syscall %v: pointer arg '%v' has output direction", c.Meta.Name, typ.Name())
}
if arg.Res == nil && !typ.Optional() {
diff --git a/sys/test.txt b/sys/test.txt
index a4381c1ad..e6865b467 100644
--- a/sys/test.txt
+++ b/sys/test.txt
@@ -187,3 +187,11 @@ syz_end_var_struct {
f1 const[0x42, int32be]
f2 flags[syz_end_flags, int64be]
} [packed]
+
+# Regression tests.
+
+syz_test$regression0(a0 ptr[inout, syz_regression0_struct])
+
+syz_regression0_struct {
+ f0 buffer[out]
+}