diff --git a/ANNOUNCE b/ANNOUNCE index 45f6fcf63..5bd8f345a 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -72,6 +72,10 @@ Version 1.6.32beta09 [August 3, 2017] Version 1.6.32beta10 [August 4, 2017] Moved chunk-length check into a png_check_chunk_length() private function (Suggested by Max Stepin). + Moved bad pngs from tests to contrib/libtests/crashers + Moved testing of bad pngs into a separate tests/pngtest-badpngs script + Added the --xfail (expected FAIL) option to pngtest.c. It writes XFAIL + in the output but PASS for the libpng test. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 30bc6c989..d5251855f 100644 --- a/CHANGES +++ b/CHANGES @@ -5955,6 +5955,10 @@ Version 1.6.32beta09 [August 3, 2017] Version 1.6.32beta10 [August 4, 2017] Moved chunk-length check into a png_check_chunk_length() private function (Suggested by Max Stepin). + Moved bad pngs from tests to contrib/libtests/crashers + Moved testing of bad pngs into a separate tests/pngtest-badpngs script + Added the --xfail (expected FAIL) option to pngtest.c. It writes XFAIL + in the output but PASS for the libpng test. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/tests/badadler.png b/contrib/testpngs/crashers/badadler.png similarity index 100% rename from tests/badadler.png rename to contrib/testpngs/crashers/badadler.png diff --git a/tests/badcrc.png b/contrib/testpngs/crashers/badcrc.png similarity index 100% rename from tests/badcrc.png rename to contrib/testpngs/crashers/badcrc.png diff --git a/tests/huge_idat.png b/contrib/testpngs/crashers/huge_idat.png similarity index 100% rename from tests/huge_idat.png rename to contrib/testpngs/crashers/huge_idat.png diff --git a/pngtest.c b/pngtest.c index 0d3f109d3..73f3a6e88 100644 --- a/pngtest.c +++ b/pngtest.c @@ -144,6 +144,7 @@ tIME_to_str(png_structp png_ptr, png_charp ts, png_const_timep t) static int verbose = 0; static int strict = 0; static int relaxed = 0; +static int xfail = 0; static int unsupported_chunks = 0; /* chunk unsupported by libpng in input */ static int error_count = 0; /* count calls to png_error */ static int warning_count = 0; /* count calls to png_warning */ @@ -1897,6 +1898,15 @@ main(int argc, char *argv[]) strict = 0; relaxed++; } + else if (strcmp(argv[1], "--xfail") == 0) + { + status_dots_requested = 0; + verbose = 1; + inname = argv[2]; + strict = 0; + xfail++; + relaxed++; + } else { @@ -1953,8 +1963,13 @@ main(int argc, char *argv[]) else { - fprintf(STDERR, " FAIL\n"); - ierror += kerror; + if (xfail) + fprintf(STDERR, " XFAIL\n"); + else + { + fprintf(STDERR, " FAIL\n"); + ierror += kerror; + } } #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG if (allocation_now != current_allocation) @@ -2042,8 +2057,13 @@ main(int argc, char *argv[]) #endif } - fprintf(STDERR, " FAIL\n"); - ierror += kerror; + if (xfail) + fprintf(STDERR, " XFAIL\n"); + else + { + fprintf(STDERR, " FAIL\n"); + ierror += kerror; + } } #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG if (allocation_now != current_allocation) diff --git a/tests/pngtest-badpngs b/tests/pngtest-badpngs new file mode 100755 index 000000000..4b24f41b2 --- /dev/null +++ b/tests/pngtest-badpngs @@ -0,0 +1,9 @@ +#!/bin/sh + +# various crashers +# using --relaxed because some come from fuzzers that don't maintain CRC's + +./pngtest --relaxed ${srcdir}/contrib/testpngs/crashers/badcrc.png +./pngtest --relaxed ${srcdir}/contrib/testpngs/crashers/badadler.png + +exec ./pngtest --xfail ${srcdir}/contrib/testpngs/crashers/huge_idat.png