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.
This commit is contained in:
parent
525ed69972
commit
546cb91d54
@ -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))
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user