From cf2e8eb485abc30ed8acc51ba5cb50d2bbc8e3d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Tue, 26 May 2020 09:22:13 +0200 Subject: [PATCH] tests: add fuzzer seed file for crash in blob_len MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Following regression was introduced in commit 5e75160f4878 ("blobmsg: fix attrs iteration in the blobmsg_check_array_len()"): Thread 1 "test-fuzz" received signal SIGSEGV, Segmentation fault. in blob_len (attr=0x6020000100d4) at libubox/blob.h:102 102 return (be32_to_cpu(attr->id_len) & BLOB_ATTR_LEN_MASK) - sizeof(struct blob_attr); blob_len (attr=0x6020000100d4) at /libubox/blob.h:102 blob_raw_len (attr=0x6020000100d4) at /libubox/blob.h:111 blob_pad_len (attr=0x6020000100d4) at /libubox/blob.h:120 blobmsg_check_array_len (attr=0x6020000000d0, type=0, blob_len=10) at /libubox/blobmsg.c:145 fuzz_blobmsg_parse (data=0x6020000000d0 "\001\004", size=10) at /libubox/tests/fuzz/test-fuzz.c:57 Signed-off-by: Petr Štetiar --- tests/cram/test_blob_parse.t | 2 ++ tests/cram/test_blobmsg_parse.t | 4 ++++ .../crash-e0f8ecc694d96a09a1fced27b2a0838b670d34a0 | Bin 0 -> 10 bytes 3 files changed, 6 insertions(+) create mode 100644 tests/fuzz/corpus/crash-e0f8ecc694d96a09a1fced27b2a0838b670d34a0 diff --git a/tests/cram/test_blob_parse.t b/tests/cram/test_blob_parse.t index 5e8b5ff..32c1b65 100644 --- a/tests/cram/test_blob_parse.t +++ b/tests/cram/test_blob_parse.t @@ -122,6 +122,8 @@ check that blob_parse is producing expected results: cannot parse cert crash-d0f3aa7d60a094b021f635d4edb7807c055a4ea1 cannot parse cert crash-df9d1243057b27bbad6211e5a23d1cb699028aa2 cannot parse cert crash-df9d1243057b27bbad6211e5a23d1cb699028aa2 + cannot parse cert crash-e0f8ecc694d96a09a1fced27b2a0838b670d34a0 + cannot parse cert crash-e0f8ecc694d96a09a1fced27b2a0838b670d34a0 cannot parse cert crash-e2fd5ecb3b37926743256f1083f47a07c39e10c2 cannot parse cert crash-e2fd5ecb3b37926743256f1083f47a07c39e10c2 cannot parse cert valid-blobmsg.bin diff --git a/tests/cram/test_blobmsg_parse.t b/tests/cram/test_blobmsg_parse.t index afed22c..ded4d08 100644 --- a/tests/cram/test_blobmsg_parse.t +++ b/tests/cram/test_blobmsg_parse.t @@ -63,6 +63,10 @@ check that blobmsg_parse is producing expected results: crash-df9d1243057b27bbad6211e5a23d1cb699028aa2: blobmsg_parse_array: ... (0) crash-df9d1243057b27bbad6211e5a23d1cb699028aa2: blobmsg_parse: ... (-1) crash-df9d1243057b27bbad6211e5a23d1cb699028aa2: blobmsg_parse_array: ... (0) + crash-e0f8ecc694d96a09a1fced27b2a0838b670d34a0: blobmsg_parse: ... (0) + crash-e0f8ecc694d96a09a1fced27b2a0838b670d34a0: blobmsg_parse_array: ... (0) + crash-e0f8ecc694d96a09a1fced27b2a0838b670d34a0: blobmsg_parse: ... (0) + crash-e0f8ecc694d96a09a1fced27b2a0838b670d34a0: blobmsg_parse_array: ... (0) crash-e2fd5ecb3b37926743256f1083f47a07c39e10c2: blobmsg_parse: ... (-1) crash-e2fd5ecb3b37926743256f1083f47a07c39e10c2: blobmsg_parse_array: ... (-1) crash-e2fd5ecb3b37926743256f1083f47a07c39e10c2: blobmsg_parse: ... (-1) diff --git a/tests/fuzz/corpus/crash-e0f8ecc694d96a09a1fced27b2a0838b670d34a0 b/tests/fuzz/corpus/crash-e0f8ecc694d96a09a1fced27b2a0838b670d34a0 new file mode 100644 index 0000000000000000000000000000000000000000..edb6bc7975b6c212034c8e573f199a4207a48938 GIT binary patch literal 10 RcmZQ%VPIfjWMD8=1pold0AT