test_fuzz.c (342360) | test_fuzz.c (348607) |
---|---|
1/*- 2 * Copyright (c) 2003-2007 Tim Kientzle 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25#include "test.h" | 1/*- 2 * Copyright (c) 2003-2007 Tim Kientzle 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25#include "test.h" |
26__FBSDID("$FreeBSD: stable/11/contrib/libarchive/libarchive/test/test_fuzz.c 342360 2018-12-21 23:33:05Z mm $"); | 26__FBSDID("$FreeBSD: stable/11/contrib/libarchive/libarchive/test/test_fuzz.c 348607 2019-06-04 10:35:54Z mm $"); |
27 28/* 29 * This was inspired by an ISO fuzz tester written by Michal Zalewski 30 * and posted to the "vulnwatch" mailing list on March 17, 2005: 31 * http://seclists.org/vulnwatch/2005/q1/0088.html 32 * 33 * This test simply reads each archive image into memory, pokes 34 * random values into it and runs it through libarchive. It tries --- 18 unchanged lines hidden (view full) --- 53 54static void 55test_fuzz(const struct files *filesets) 56{ 57 const void *blk; 58 size_t blk_size; 59 int64_t blk_offset; 60 int n; | 27 28/* 29 * This was inspired by an ISO fuzz tester written by Michal Zalewski 30 * and posted to the "vulnwatch" mailing list on March 17, 2005: 31 * http://seclists.org/vulnwatch/2005/q1/0088.html 32 * 33 * This test simply reads each archive image into memory, pokes 34 * random values into it and runs it through libarchive. It tries --- 18 unchanged lines hidden (view full) --- 53 54static void 55test_fuzz(const struct files *filesets) 56{ 57 const void *blk; 58 size_t blk_size; 59 int64_t blk_offset; 60 int n; |
61 const char *skip_fuzz_tests; |
|
61 | 62 |
63 skip_fuzz_tests = getenv("SKIP_TEST_FUZZ"); 64 if (skip_fuzz_tests != NULL) { 65 skipping("Skipping fuzz tests due to SKIP_TEST_FUZZ " 66 "environment variable"); 67 return; 68 } 69 |
|
62 for (n = 0; filesets[n].names != NULL; ++n) { 63 const size_t buffsize = 30000000; 64 struct archive_entry *ae; 65 struct archive *a; 66 char *rawimage = NULL, *image = NULL, *tmp = NULL; 67 size_t size = 0, oldsize = 0; 68 int i, q; 69 --- 562 unchanged lines hidden --- | 70 for (n = 0; filesets[n].names != NULL; ++n) { 71 const size_t buffsize = 30000000; 72 struct archive_entry *ae; 73 struct archive *a; 74 char *rawimage = NULL, *image = NULL, *tmp = NULL; 75 size_t size = 0, oldsize = 0; 76 int i, q; 77 --- 562 unchanged lines hidden --- |