From owner-svn-src-all@FreeBSD.ORG Mon Apr 27 18:55:23 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C71110656F2; Mon, 27 Apr 2009 18:55:23 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F2008FC0A; Mon, 27 Apr 2009 18:55:23 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n3RItNRA023515; Mon, 27 Apr 2009 18:55:23 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n3RItMMo023513; Mon, 27 Apr 2009 18:55:22 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200904271855.n3RItMMo023513@svn.freebsd.org> From: Tim Kientzle Date: Mon, 27 Apr 2009 18:55:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r191584 - head/lib/libarchive/test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 18:55:24 -0000 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);