svn commit: r191584 - head/lib/libarchive/test
Tim Kientzle
kientzle at FreeBSD.org
Mon Apr 27 18:55:24 UTC 2009
Author: kientzle
Date: Mon Apr 27 18:55:22 2009
New Revision: 191584
URL: http://svn.freebsd.org/changeset/base/191584
Log:
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.
Modified:
head/lib/libarchive/test/test.h
head/lib/libarchive/test/test_fuzz.c
Modified: head/lib/libarchive/test/test.h
==============================================================================
--- head/lib/libarchive/test/test.h Mon Apr 27 18:46:57 2009 (r191583)
+++ head/lib/libarchive/test/test.h Mon Apr 27 18:55:22 2009 (r191584)
@@ -194,14 +194,3 @@ int read_open_memory2(struct archive *,
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))
-
Modified: head/lib/libarchive/test/test_fuzz.c
==============================================================================
--- head/lib/libarchive/test/test_fuzz.c Mon Apr 27 18:46:57 2009 (r191583)
+++ head/lib/libarchive/test/test_fuzz.c Mon Apr 27 18:55:22 2009 (r191584)
@@ -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);
More information about the svn-src-head
mailing list