Skip to content

Commit

Permalink
Add a fuzz tester to the libarchive test suite. This
Browse files Browse the repository at this point in the history
takes known-good archives, changes random bytes, then feeds
them through libarchive trying to provoke a crash or hang.

This has exposed a couple of problems reading malformed
ISO9660 images.  As a result, I now have a rewritten
Rockridge extension parser, better handling of malformed
PVDs, and some additional checks around end-of-archive conditions.

SVN-Revision: 260
  • Loading branch information
kientzle committed Nov 22, 2008
1 parent 4df04ed commit 56f6b5f
Show file tree
Hide file tree
Showing 8 changed files with 27,491 additions and 160 deletions.
6 changes: 6 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,13 @@ libarchive_test_SOURCES= \
libarchive/test/test_acl_pax.c \
libarchive/test/test_archive_api_feature.c \
libarchive/test/test_bad_fd.c \
libarchive/test/test_compat_bzip2.c \
libarchive/test/test_compat_gtar.c \
libarchive/test/test_compat_tar_hardlink.c \
libarchive/test/test_compat_zip.c \
libarchive/test/test_empty_write.c \
libarchive/test/test_entry.c \
libarchive/test/test_fuzz.c \
libarchive/test/test_entry_strmode.c \
libarchive/test/test_link_resolver.c \
libarchive/test/test_pax_filename_encoding.c \
Expand Down Expand Up @@ -251,9 +253,12 @@ libarchive/test/list.h: Makefile
libarchive_TESTS_ENVIRONMENT= LIBARCHIVE_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/libarchive/test

libarchive_test_EXTRA_DIST=\
libarchive/test/test_compat_bzip2_1.tbz.uu \
libarchive/test/test_compat_bzip2_2.tbz.uu \
libarchive/test/test_compat_gtar_1.tgz.uu \
libarchive/test/test_compat_tar_hardlink_1.tar.uu \
libarchive/test/test_compat_zip_1.zip.uu \
libarchive/test/test_fuzz_1.iso.uu \
libarchive/test/test_pax_filename_encoding.tar.gz.uu \
libarchive/test/test_read_format_gtar_sparse_1_13.tgz.uu \
libarchive/test/test_read_format_gtar_sparse_1_17.tgz.uu \
Expand Down Expand Up @@ -326,6 +331,7 @@ bsdtar_test_SOURCES= \
tar/test/test_option_T.c \
tar/test/test_patterns.c \
tar/test/test_stdio.c \
tar/test/test_strip_components.c \
tar/test/test_symlink_dir.c \
tar/test/test_version.c

Expand Down
5 changes: 1 addition & 4 deletions libarchive/archive_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,10 +862,7 @@ __archive_read_ahead(struct archive_read *a, size_t min, ssize_t *avail)
/* Return whatever we do have. */
if (avail != NULL)
*avail = a->avail;
return (a->next);
/* TODO: I want to change this to
* return(0) as an eof marker, but a little
* more work is needed first. */
return (NULL);
}
a->archive.raw_position += bytes_read;
a->client_total = bytes_read;
Expand Down
Loading

0 comments on commit 56f6b5f

Please sign in to comment.