[libpng16] 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.
This commit is contained in:
Glenn Randers-Pehrson 2017-08-04 14:17:28 -05:00
parent 2dca15686f
commit 207392821d
7 changed files with 41 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

Before

Width:  |  Height:  |  Size: 67 B

After

Width:  |  Height:  |  Size: 67 B

View File

Before

Width:  |  Height:  |  Size: 67 B

After

Width:  |  Height:  |  Size: 67 B

View File

Before

Width:  |  Height:  |  Size: 79 B

After

Width:  |  Height:  |  Size: 79 B

View File

@ -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)

9
tests/pngtest-badpngs Executable file
View File

@ -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