aboutsummaryrefslogtreecommitdiffstats
path: root/prog
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2016-12-20 18:12:07 +0100
committerAndrey Konovalov <andreyknvl@google.com>2016-12-20 18:12:07 +0100
commitdf98b6bde521211c8f1246157e5e6a4a40e710f4 (patch)
tree648a0abb9db00f2364c028154807666ec2b51d6b /prog
parent80b6c954f8daa8d9910698be9eca6d97284a75a0 (diff)
prog: add bytesizeN types
Diffstat (limited to 'prog')
-rw-r--r--prog/analysis.go4
-rw-r--r--prog/size_test.go4
2 files changed, 6 insertions, 2 deletions
diff --git a/prog/analysis.go b/prog/analysis.go
index ad962f3f2..6348a48c6 100644
--- a/prog/analysis.go
+++ b/prog/analysis.go
@@ -160,8 +160,8 @@ func generateSize(arg *Arg, lenType *sys.LenType) *Arg {
case *sys.VmaType:
return pageSizeArg(lenType, arg.AddrPagesNum, 0)
case *sys.ArrayType:
- if lenType.ByteSize {
- return constArg(lenType, arg.Size())
+ if lenType.ByteSize != 0 {
+ return constArg(lenType, arg.Size() / lenType.ByteSize)
} else {
return constArg(lenType, uintptr(len(arg.Inner)))
}
diff --git a/prog/size_test.go b/prog/size_test.go
index 9faa27546..c257eae31 100644
--- a/prog/size_test.go
+++ b/prog/size_test.go
@@ -102,6 +102,10 @@ func TestAssignSize(t *testing.T) {
"syz_test$length15(0xff, 0x0)",
"syz_test$length15(0xff, 0x2)",
},
+ {
+ "syz_test$length16(&(0x7f0000000000)={[0x42, 0x42], 0xff, 0xff, 0xff, 0xff, 0xff})",
+ "syz_test$length16(&(0x7f0000000000)={[0x42, 0x42], 0x2, 0x10, 0x8, 0x4, 0x2})",
+ },
}
for i, test := range tests {