diff options
author | Martin Matuska <mm@FreeBSD.org> | 2017-05-03 23:55:12 +0000 |
---|---|---|
committer | Martin Matuska <mm@FreeBSD.org> | 2017-05-03 23:55:12 +0000 |
commit | 87a07d9d6c9aca33aa7189ddf8dc13fd4ed795e9 (patch) | |
tree | b8ac4af3d780f51917c8a060892b1633cce98aca /cpio/test | |
parent | 659b8836cb5cd1ff479c8644211f190e1ad9619d (diff) | |
download | src-87a07d9d6c9aca33aa7189ddf8dc13fd4ed795e9.tar.gz src-87a07d9d6c9aca33aa7189ddf8dc13fd4ed795e9.zip |
Update vendor/libarchive to git c253f0aae9ac86a617b4f814137e07757df72391
Vendor changes (FreeBSD-related):
PR 897: test for ZIP archives with invalid EOCD headers
PR 901: fix invalid renaming of sparse files
OSS-Fuzz issue 497: remove fallback tree in LZX decoder
OSS-Fuzz issue 527: rewrite expressions in lz4 filter
OSS-Fuzz issue 577: fix integer overflow in cpio reader
OSS-Fuzz issue 862: fix numerc parsing in mtree reader
OSS-Fuzz issue 1097: fix undefined shift in rar reader
cpio: various optimizations and memory leak fixes
Notes
Notes:
svn path=/vendor/libarchive/dist/; revision=317781
Diffstat (limited to 'cpio/test')
-rw-r--r-- | cpio/test/test_option_Z_upper.c | 5 | ||||
-rw-r--r-- | cpio/test/test_option_a.c | 3 | ||||
-rw-r--r-- | cpio/test/test_option_b64encode.c | 2 | ||||
-rw-r--r-- | cpio/test/test_option_grzip.c | 3 | ||||
-rw-r--r-- | cpio/test/test_option_lrzip.c | 3 | ||||
-rw-r--r-- | cpio/test/test_option_lz4.c | 7 | ||||
-rw-r--r-- | cpio/test/test_option_lzma.c | 4 | ||||
-rw-r--r-- | cpio/test/test_option_lzop.c | 3 | ||||
-rw-r--r-- | cpio/test/test_option_uuencode.c | 2 | ||||
-rw-r--r-- | cpio/test/test_option_xz.c | 4 | ||||
-rw-r--r-- | cpio/test/test_option_y.c | 6 | ||||
-rw-r--r-- | cpio/test/test_option_z.c | 3 |
12 files changed, 34 insertions, 11 deletions
diff --git a/cpio/test/test_option_Z_upper.c b/cpio/test/test_option_Z_upper.c index d69a85ea58ae..ff388427e372 100644 --- a/cpio/test/test_option_Z_upper.c +++ b/cpio/test/test_option_Z_upper.c @@ -43,17 +43,18 @@ DEFINE_TEST(test_option_Z_upper) if (strstr(p, "compression not available") != NULL) { skipping("This version of bsdcpio was compiled " "without compress support"); + free(p); return; } failure("-Z option is broken"); assertEqualInt(r, 0); - goto done; + free(p); + return; } free(p); /* Check that the archive file has a compress signature. */ p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "\x1f\x9d", 2); -done: free(p); } diff --git a/cpio/test/test_option_a.c b/cpio/test/test_option_a.c index 606de606e2c5..296387777ccf 100644 --- a/cpio/test/test_option_a.c +++ b/cpio/test/test_option_a.c @@ -96,7 +96,8 @@ DEFINE_TEST(test_option_a) test_create(); /* Sanity check; verify that atimes really do get modified. */ - assert((p = slurpfile(NULL, "f0")) != NULL); + p = slurpfile(NULL, "f0"); + assert(p != NULL); free(p); assertEqualInt(0, stat("f0", &st)); if (st.st_atime == files[0].atime_sec) { diff --git a/cpio/test/test_option_b64encode.c b/cpio/test/test_option_b64encode.c index 8f6b4157c01c..7c15a8230606 100644 --- a/cpio/test/test_option_b64encode.c +++ b/cpio/test/test_option_b64encode.c @@ -42,6 +42,7 @@ DEFINE_TEST(test_option_b64encode) p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "begin-base64 644", 16); + free(p); /* Archive it with uuencode only. */ assertEqualInt(0, @@ -51,4 +52,5 @@ DEFINE_TEST(test_option_b64encode) p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "begin-base64 644", 16); + free(p); } diff --git a/cpio/test/test_option_grzip.c b/cpio/test/test_option_grzip.c index dfce2e064e07..7e7dd2c8e6f3 100644 --- a/cpio/test/test_option_grzip.c +++ b/cpio/test/test_option_grzip.c @@ -44,9 +44,10 @@ DEFINE_TEST(test_option_grzip) systemf("echo f | %s -o --grzip >archive.out 2>archive.err", testprog)); p = slurpfile(&s, "archive.err"); - p[s] = '\0'; + free(p); /* Check that the archive file has an grzip signature. */ p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "GRZipII\x00\x02\x04:)", 12); + free(p); } diff --git a/cpio/test/test_option_lrzip.c b/cpio/test/test_option_lrzip.c index a84f75157a4c..8d9c0d576cc3 100644 --- a/cpio/test/test_option_lrzip.c +++ b/cpio/test/test_option_lrzip.c @@ -44,9 +44,10 @@ DEFINE_TEST(test_option_lrzip) systemf("echo f | %s -o --lrzip >archive.out 2>archive.err", testprog)); p = slurpfile(&s, "archive.err"); - p[s] = '\0'; + free(p); /* Check that the archive file has an lzma signature. */ p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "LRZI\x00", 5); + free(p); } diff --git a/cpio/test/test_option_lz4.c b/cpio/test/test_option_lz4.c index afd683ddc773..88dfbd63bae9 100644 --- a/cpio/test/test_option_lz4.c +++ b/cpio/test/test_option_lz4.c @@ -43,6 +43,7 @@ DEFINE_TEST(test_option_lz4) if (strstr(p, "compression not available") != NULL) { skipping("This version of bsdcpio was compiled " "without lz4 support"); + free(p); return; } /* POSIX permits different handling of the spawnp @@ -52,6 +53,7 @@ DEFINE_TEST(test_option_lz4) if (strstr(p, "Can't launch") != NULL && !canLz4()) { skipping("This version of bsdcpio uses an external lz4 program " "but no such program is available on this system."); + free(p); return; } /* Some systems successfully spawn the new process, @@ -61,6 +63,7 @@ DEFINE_TEST(test_option_lz4) if (strstr(p, "Can't write") != NULL && !canLz4()) { skipping("This version of bsdcpio uses an external lz4 program " "but no such program is available on this system."); + free(p); return; } /* On some systems the error won't be detected until closing @@ -68,14 +71,18 @@ DEFINE_TEST(test_option_lz4) if (strstr(p, "Error closing") != NULL && !canLz4()) { skipping("This version of bsdcpio uses an external lz4 program " "but no such program is available on this system."); + free(p); return; } + free(p); failure("--lz4 option is broken: %s", p); assertEqualInt(r, 0); return; } + free(p); /* Check that the archive file has an lz4 signature. */ p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "\x04\x22\x4d\x18", 4); + free(p); } diff --git a/cpio/test/test_option_lzma.c b/cpio/test/test_option_lzma.c index c6e335301505..b7cad3d1e99a 100644 --- a/cpio/test/test_option_lzma.c +++ b/cpio/test/test_option_lzma.c @@ -43,14 +43,18 @@ DEFINE_TEST(test_option_lzma) if (strstr(p, "compression not available") != NULL) { skipping("This version of bsdcpio was compiled " "without lzma support"); + free(p); return; } failure("--lzma option is broken"); assertEqualInt(r, 0); + free(p); return; } + free(p); /* Check that the archive file has an lzma signature. */ p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "\x5d\00\00", 3); + free(p); } diff --git a/cpio/test/test_option_lzop.c b/cpio/test/test_option_lzop.c index 9f1666e9c5b9..aa40ef5b6392 100644 --- a/cpio/test/test_option_lzop.c +++ b/cpio/test/test_option_lzop.c @@ -39,7 +39,7 @@ DEFINE_TEST(test_option_lzop) r = systemf("echo f | %s -o --lzop >archive.out 2>archive.err", testprog); p = slurpfile(&s, "archive.err"); - p[s] = '\0'; + free(p); if (r != 0) { if (!canLzop()) { skipping("lzop is not supported on this platform"); @@ -53,4 +53,5 @@ DEFINE_TEST(test_option_lzop) p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "\x89\x4c\x5a\x4f\x00\x0d\x0a\x1a\x0a", 9); + free(p); } diff --git a/cpio/test/test_option_uuencode.c b/cpio/test/test_option_uuencode.c index ecf354f8f391..a42a0e03096f 100644 --- a/cpio/test/test_option_uuencode.c +++ b/cpio/test/test_option_uuencode.c @@ -42,6 +42,7 @@ DEFINE_TEST(test_option_uuencode) p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "begin 644", 9); + free(p); /* Archive it with uuencode only. */ assertEqualInt(0, @@ -51,4 +52,5 @@ DEFINE_TEST(test_option_uuencode) p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "begin 644", 9); + free(p); } diff --git a/cpio/test/test_option_xz.c b/cpio/test/test_option_xz.c index 02b5dfaad4a1..f0d3b33d45b8 100644 --- a/cpio/test/test_option_xz.c +++ b/cpio/test/test_option_xz.c @@ -44,14 +44,18 @@ DEFINE_TEST(test_option_xz) if (strstr(p, "compression not available") != NULL) { skipping("This version of bsdcpio was compiled " "without xz support"); + free(p); return; } + free(p); failure("--xz option is broken"); assertEqualInt(r, 0); return; } + free(p); /* Check that the archive file has an xz signature. */ p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "\xFD\x37\x7A\x58\x5A\x00", 6); + free(p); } diff --git a/cpio/test/test_option_y.c b/cpio/test/test_option_y.c index 0397b3d1bf45..989b5f1aaf6e 100644 --- a/cpio/test/test_option_y.c +++ b/cpio/test/test_option_y.c @@ -38,7 +38,7 @@ DEFINE_TEST(test_option_y) r = systemf("echo f | %s -oy >archive.out 2>archive.err", testprog); p = slurpfile(&s, "archive.err"); - p[s] = '\0'; + free(p); if (r != 0) { if (!canBzip2()) { skipping("bzip2 is not supported on this platform"); @@ -46,14 +46,12 @@ DEFINE_TEST(test_option_y) } failure("-y option is broken"); assertEqualInt(r, 0); - goto done; + return; } assertTextFileContents("1 block\n", "archive.err"); /* Check that the archive file has a bzip2 signature. */ - free(p); p = slurpfile(&s, "archive.out"); assert(s > 2); assertEqualMem(p, "BZh9", 4); -done: free(p); } diff --git a/cpio/test/test_option_z.c b/cpio/test/test_option_z.c index 0b68a42babbf..803232d045c2 100644 --- a/cpio/test/test_option_z.c +++ b/cpio/test/test_option_z.c @@ -38,7 +38,7 @@ DEFINE_TEST(test_option_z) r = systemf("echo f | %s -oz >archive.out 2>archive.err", testprog); p = slurpfile(&s, "archive.err"); - p[s] = '\0'; + free(p); if (r != 0) { if (!canGzip()) { skipping("gzip is not supported on this platform"); @@ -52,4 +52,5 @@ DEFINE_TEST(test_option_z) p = slurpfile(&s, "archive.out"); assert(s > 4); assertEqualMem(p, "\x1f\x8b\x08\x00", 4); + free(p); } |