From df98b6bde521211c8f1246157e5e6a4a40e710f4 Mon Sep 17 00:00:00 2001 From: Andrey Konovalov Date: Tue, 20 Dec 2016 18:12:07 +0100 Subject: prog: add bytesizeN types --- prog/analysis.go | 4 ++-- prog/size_test.go | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'prog') 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 { -- cgit mrf-deployment