aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2016-09-30 19:14:50 +0200
committerAndrey Konovalov <andreyknvl@google.com>2016-10-04 18:50:02 +0200
commitf2d77726c8e7d2662bda0414d55073cd51742ff3 (patch)
treea1c278f4d18496efbbcaf21dc541e09c588710a3
parentc99cbdbe58f7817a2ee6064e72db25fc1d067b41 (diff)
Add exec serialize tests for array[int8]
-rw-r--r--prog/encodingexec_test.go19
-rw-r--r--sys/test.txt13
2 files changed, 32 insertions, 0 deletions
diff --git a/prog/encodingexec_test.go b/prog/encodingexec_test.go
index eddda5199..e166e8ae8 100644
--- a/prog/encodingexec_test.go
+++ b/prog/encodingexec_test.go
@@ -110,6 +110,25 @@ func TestSerializeForExec(t *testing.T) {
instrEOF,
},
},
+ {
+ "syz_test$array1(&(0x7f0000000000)={0x42, \"0102030405\"})",
+ []uint64{
+ instrCopyin, dataOffset + 0, argConst, 1, 0x42,
+ instrCopyin, dataOffset + 1, argData, 5, 0x0504030201,
+ callID("syz_test$array1"), 1, argConst, ptrSize, dataOffset,
+ instrEOF,
+ },
+ },
+ {
+ "syz_test$array2(&(0x7f0000000000)={0x42, \"aaaaaaaabbbbbbbbccccccccdddddddd\", 0x43})",
+ []uint64{
+ instrCopyin, dataOffset + 0, argConst, 2, 0x42,
+ instrCopyin, dataOffset + 2, argData, 16, 0xbbbbbbbbaaaaaaaa, 0xddddddddcccccccc,
+ instrCopyin, dataOffset + 18, argConst, 2, 0x43,
+ callID("syz_test$array2"), 1, argConst, ptrSize, dataOffset,
+ instrEOF,
+ },
+ },
}
for i, test := range tests {
diff --git a/sys/test.txt b/sys/test.txt
index a01c6b3c2..6420ed54c 100644
--- a/sys/test.txt
+++ b/sys/test.txt
@@ -51,6 +51,8 @@ syz_union0 [
# Arrays.
syz_test$array0(a0 ptr[in, syz_array_struct])
+syz_test$array1(a0 ptr[in, syz_array_trailing])
+syz_test$array2(a0 ptr[in, syz_array_blob])
# Struct with a variable-length array or variable-length unions.
syz_array_struct {
@@ -63,3 +65,14 @@ syz_array_union [
f0 int16
f1 int64
] [varlen]
+
+syz_array_trailing {
+ f0 int8
+ f1 array[int8, 4:8]
+}
+
+syz_array_blob {
+ f0 int16
+ f1 array[int8, 16]
+ f2 int16
+}