diff options
author | kientzle <kientzle@FreeBSD.org> | 2009-04-27 18:55:22 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2009-04-27 18:55:22 +0000 |
commit | 2d15a97dfa737b4ff043559cd6a72649c60e989a (patch) | |
tree | 67f07c96e76c4235f0cc1826d03c690a761b71dd /lib | |
parent | f5c80120f0ce6ffb0b908a9590f1a170522f2830 (diff) | |
download | FreeBSD-src-2d15a97dfa737b4ff043559cd6a72649c60e989a.zip FreeBSD-src-2d15a97dfa737b4ff043559cd6a72649c60e989a.tar.gz |
Merge r1032 from libarchive.googlecode.com:
Make test_fuzz a bit more sensitive by actually reading the body
of each entry instead of skipping it.
While I'm here, move the "UnsupportedCompress" macro into the
only file that still uses it.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libarchive/test/test.h | 11 | ||||
-rw-r--r-- | lib/libarchive/test/test_fuzz.c | 17 |
2 files changed, 16 insertions, 12 deletions
diff --git a/lib/libarchive/test/test.h b/lib/libarchive/test/test.h index ac3ad4f..94c66e8 100644 --- a/lib/libarchive/test/test.h +++ b/lib/libarchive/test/test.h @@ -194,14 +194,3 @@ int read_open_memory2(struct archive *, void *, size_t, size_t); test_assert_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (a)) #define assertEqualStringA(a,v1,v2) \ test_assert_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (a)) - -/* - * A compression is not supported - * Use this define after archive_read_next_header() is called - */ -#define UnsupportedCompress(r, a) \ - (r != ARCHIVE_OK && \ - (strcmp(archive_error_string(a), \ - "Unrecognized archive format") == 0 && \ - archive_compression(a) == ARCHIVE_COMPRESSION_NONE)) - diff --git a/lib/libarchive/test/test_fuzz.c b/lib/libarchive/test/test_fuzz.c index ab25c27..9c5a056 100644 --- a/lib/libarchive/test/test_fuzz.c +++ b/lib/libarchive/test/test_fuzz.c @@ -61,9 +61,18 @@ files[] = { NULL }; +#define UnsupportedCompress(r, a) \ + (r != ARCHIVE_OK && \ + (strcmp(archive_error_string(a), \ + "Unrecognized archive format") == 0 && \ + archive_compression(a) == ARCHIVE_COMPRESSION_NONE)) + DEFINE_TEST(test_fuzz) { const char **filep; + const void *blk; + size_t blk_size; + off_t blk_offset; for (filep = files; *filep != NULL; ++filep) { struct archive_entry *ae; @@ -105,6 +114,10 @@ DEFINE_TEST(test_fuzz) assert(0 == archive_read_finish(a)); continue; } + while (0 == archive_read_data_block(a, &blk, + &blk_size, &blk_offset)) + continue; + } assert(0 == archive_read_close(a)); assert(0 == archive_read_finish(a)); @@ -134,7 +147,9 @@ DEFINE_TEST(test_fuzz) if (0 == archive_read_open_memory(a, image, size)) { while(0 == archive_read_next_header(a, &ae)) { - archive_read_data_skip(a); + while (0 == archive_read_data_block(a, + &blk, &blk_size, &blk_offset)) + continue; } archive_read_close(a); archive_read_finish(a); |