mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng16] Add tests/badcrc.png and tests/badadler.png to tests/pngtest.
Merged pngtest.c with libpng-1.7.0beta84/pngtest.c
This commit is contained in:
parent
89ea081433
commit
8aa1638ccc
7
ANNOUNCE
7
ANNOUNCE
@ -1,4 +1,4 @@
|
|||||||
Libpng 1.6.26beta01 - September 25, 2016
|
Libpng 1.6.26beta01 - September 26, 2016
|
||||||
|
|
||||||
This is not intended to be a public release. It will be replaced
|
This is not intended to be a public release. It will be replaced
|
||||||
within a few weeks by a public version or by another test version.
|
within a few weeks by a public version or by another test version.
|
||||||
@ -25,7 +25,7 @@ Other information:
|
|||||||
|
|
||||||
Changes since the last public release (1.6.25):
|
Changes since the last public release (1.6.25):
|
||||||
|
|
||||||
Version 1.6.26beta01 [September 25, 2016]
|
Version 1.6.26beta01 [September 26, 2016]
|
||||||
Fixed handling zero length IDAT in pngfix (bug report by Agostino Sarubbo,
|
Fixed handling zero length IDAT in pngfix (bug report by Agostino Sarubbo,
|
||||||
bugfix by John Bowler).
|
bugfix by John Bowler).
|
||||||
Do not issue a png_error() on read in png_set_pCAL() because png_handle_pCAL
|
Do not issue a png_error() on read in png_set_pCAL() because png_handle_pCAL
|
||||||
@ -37,6 +37,9 @@ Version 1.6.26beta01 [September 25, 2016]
|
|||||||
pngrutil.c.
|
pngrutil.c.
|
||||||
If CRC handling of critical chunks has been set to PNG_CRC_QUIET_USE,
|
If CRC handling of critical chunks has been set to PNG_CRC_QUIET_USE,
|
||||||
ignore the ADLER32 checksum in the IDAT chunk as well as the chunk CRCs.
|
ignore the ADLER32 checksum in the IDAT chunk as well as the chunk CRCs.
|
||||||
|
Issue png_benign_error() on ADLER32 checksum mismatch instead of png_error().
|
||||||
|
Add tests/badcrc.png and tests/badadler.png to tests/pngtest.
|
||||||
|
Merged pngtest.c with libpng-1.7.0beta84/pngtest.c
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
5
CHANGES
5
CHANGES
@ -5703,7 +5703,7 @@ Version 1.6.25rc05 [August 30, 2016]
|
|||||||
Version 1.6.25 [September 1, 2016]
|
Version 1.6.25 [September 1, 2016]
|
||||||
No changes.
|
No changes.
|
||||||
|
|
||||||
Version 1.6.26beta01 [September 25, 2016]
|
Version 1.6.26beta01 [September 26, 2016]
|
||||||
Fixed handling zero length IDAT in pngfix (bug report by Agostino Sarubbo,
|
Fixed handling zero length IDAT in pngfix (bug report by Agostino Sarubbo,
|
||||||
bugfix by John Bowler).
|
bugfix by John Bowler).
|
||||||
Do not issue a png_error() on read in png_set_pCAL() because png_handle_pCAL
|
Do not issue a png_error() on read in png_set_pCAL() because png_handle_pCAL
|
||||||
@ -5715,6 +5715,9 @@ Version 1.6.26beta01 [September 25, 2016]
|
|||||||
pngrutil.c.
|
pngrutil.c.
|
||||||
If CRC handling of critical chunks has been set to PNG_CRC_QUIET_USE,
|
If CRC handling of critical chunks has been set to PNG_CRC_QUIET_USE,
|
||||||
ignore the ADLER32 checksum in the IDAT chunk as well as the chunk CRCs.
|
ignore the ADLER32 checksum in the IDAT chunk as well as the chunk CRCs.
|
||||||
|
Issue png_benign_error() on ADLER32 checksum mismatch instead of png_error().
|
||||||
|
Add tests/badcrc.png and tests/badadler.png to tests/pngtest.
|
||||||
|
Merged pngtest.c with libpng-1.7.0beta84/pngtest.c
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
93
pngtest.c
93
pngtest.c
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
/* pngtest.c - a simple test program to test libpng
|
/* pngtest.c - a simple test program to test libpng
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.25 [September 1, 2016]
|
* Last changed in libpng 1.7.0 [(PENDING RELEASE)]
|
||||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
@ -43,15 +43,6 @@
|
|||||||
|
|
||||||
#include "png.h"
|
#include "png.h"
|
||||||
|
|
||||||
/* 1.6.1 added support for the configure test harness, which uses 77 to indicate
|
|
||||||
* a skipped test, in earlier versions we need to succeed on a skipped test, so:
|
|
||||||
*/
|
|
||||||
#if PNG_LIBPNG_VER >= 10601 && defined(HAVE_CONFIG_H)
|
|
||||||
# define SKIP 77
|
|
||||||
#else
|
|
||||||
# define SKIP 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Known chunks that exist in pngtest.png must be supported or pngtest will fail
|
/* Known chunks that exist in pngtest.png must be supported or pngtest will fail
|
||||||
* simply as a result of re-ordering them. This may be fixed in 1.7
|
* simply as a result of re-ordering them. This may be fixed in 1.7
|
||||||
*
|
*
|
||||||
@ -514,10 +505,10 @@ typedef struct memory_information
|
|||||||
typedef memory_information *memory_infop;
|
typedef memory_information *memory_infop;
|
||||||
|
|
||||||
static memory_infop pinformation = NULL;
|
static memory_infop pinformation = NULL;
|
||||||
static png_alloc_size_t current_allocation = 0;
|
static int current_allocation = 0;
|
||||||
static png_alloc_size_t maximum_allocation = 0;
|
static int maximum_allocation = 0;
|
||||||
static png_alloc_size_t total_allocation = 0;
|
static int total_allocation = 0;
|
||||||
static png_alloc_size_t num_allocations = 0;
|
static int num_allocations = 0;
|
||||||
|
|
||||||
png_voidp PNGCBAPI png_debug_malloc PNGARG((png_structp png_ptr,
|
png_voidp PNGCBAPI png_debug_malloc PNGARG((png_structp png_ptr,
|
||||||
png_alloc_size_t size));
|
png_alloc_size_t size));
|
||||||
@ -604,10 +595,9 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
|
|||||||
if (pinfo->pointer == ptr)
|
if (pinfo->pointer == ptr)
|
||||||
{
|
{
|
||||||
*ppinfo = pinfo->next;
|
*ppinfo = pinfo->next;
|
||||||
if (current_allocation < pinfo->size)
|
|
||||||
fprintf(STDERR, "Duplicate free of memory\n");
|
|
||||||
else
|
|
||||||
current_allocation -= pinfo->size;
|
current_allocation -= pinfo->size;
|
||||||
|
if (current_allocation < 0)
|
||||||
|
fprintf(STDERR, "Duplicate free of memory\n");
|
||||||
/* We must free the list element too, but first kill
|
/* We must free the list element too, but first kill
|
||||||
the memory that is to be freed. */
|
the memory that is to be freed. */
|
||||||
memset(ptr, 0x55, pinfo->size);
|
memset(ptr, 0x55, pinfo->size);
|
||||||
@ -939,12 +929,6 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
read_user_chunk_callback);
|
read_user_chunk_callback);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
|
||||||
# ifdef CHUNK_LIMIT /* from the build, for testing */
|
|
||||||
png_set_chunk_malloc_max(read_ptr, CHUNK_LIMIT);
|
|
||||||
# endif /* CHUNK_LIMIT */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
pngtest_debug("Setting jmpbuf for read struct");
|
pngtest_debug("Setting jmpbuf for read struct");
|
||||||
if (setjmp(png_jmpbuf(read_ptr)))
|
if (setjmp(png_jmpbuf(read_ptr)))
|
||||||
@ -1002,9 +986,13 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
/* Allow application (pngtest) errors and warnings to pass */
|
/* Allow application (pngtest) errors and warnings to pass */
|
||||||
png_set_benign_errors(read_ptr, 1);
|
png_set_benign_errors(read_ptr, 1);
|
||||||
|
|
||||||
|
/* Turn off CRC and ADLER32 checking while reading */
|
||||||
|
png_set_crc_action(read_ptr, PNG_CRC_QUIET_USE, PNG_CRC_QUIET_USE);
|
||||||
|
|
||||||
# ifdef PNG_WRITE_SUPPORTED
|
# ifdef PNG_WRITE_SUPPORTED
|
||||||
png_set_benign_errors(write_ptr, 1);
|
png_set_benign_errors(write_ptr, 1);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif /* BENIGN_ERRORS */
|
#endif /* BENIGN_ERRORS */
|
||||||
|
|
||||||
@ -1404,6 +1392,11 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
png_write_info(write_ptr, write_info_ptr);
|
png_write_info(write_ptr, write_info_ptr);
|
||||||
|
|
||||||
write_chunks(write_ptr, before_IDAT); /* after PLTE */
|
write_chunks(write_ptr, before_IDAT); /* after PLTE */
|
||||||
|
|
||||||
|
#ifdef PNG_COMPRESSION_COMPAT
|
||||||
|
/* Test the 'compatibility' setting here, if it is available. */
|
||||||
|
png_set_compression(write_ptr, PNG_COMPRESSION_COMPAT);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SINGLE_ROWBUF_ALLOC
|
#ifdef SINGLE_ROWBUF_ALLOC
|
||||||
@ -1885,7 +1878,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
||||||
png_alloc_size_t allocation_now = current_allocation;
|
int allocation_now = current_allocation;
|
||||||
#endif
|
#endif
|
||||||
for (i=2; i<argc; ++i)
|
for (i=2; i<argc; ++i)
|
||||||
{
|
{
|
||||||
@ -1918,15 +1911,15 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
||||||
if (allocation_now != current_allocation)
|
if (allocation_now != current_allocation)
|
||||||
fprintf(STDERR, "MEMORY ERROR: %lu bytes lost\n",
|
fprintf(STDERR, "MEMORY ERROR: %d bytes lost\n",
|
||||||
(unsigned long)(current_allocation - allocation_now));
|
current_allocation - allocation_now);
|
||||||
|
|
||||||
if (current_allocation != 0)
|
if (current_allocation != 0)
|
||||||
{
|
{
|
||||||
memory_infop pinfo = pinformation;
|
memory_infop pinfo = pinformation;
|
||||||
|
|
||||||
fprintf(STDERR, "MEMORY ERROR: %lu bytes still allocated\n",
|
fprintf(STDERR, "MEMORY ERROR: %d bytes still allocated\n",
|
||||||
(unsigned long)current_allocation);
|
current_allocation);
|
||||||
|
|
||||||
while (pinfo != NULL)
|
while (pinfo != NULL)
|
||||||
{
|
{
|
||||||
@ -1939,14 +1932,14 @@ main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
||||||
fprintf(STDERR, " Current memory allocation: %20lu bytes\n",
|
fprintf(STDERR, " Current memory allocation: %10d bytes\n",
|
||||||
(unsigned long)current_allocation);
|
current_allocation);
|
||||||
fprintf(STDERR, " Maximum memory allocation: %20lu bytes\n",
|
fprintf(STDERR, " Maximum memory allocation: %10d bytes\n",
|
||||||
(unsigned long) maximum_allocation);
|
maximum_allocation);
|
||||||
fprintf(STDERR, " Total memory allocation: %20lu bytes\n",
|
fprintf(STDERR, " Total memory allocation: %10d bytes\n",
|
||||||
(unsigned long)total_allocation);
|
total_allocation);
|
||||||
fprintf(STDERR, " Number of allocations: %20lu\n",
|
fprintf(STDERR, " Number of allocations: %10d\n",
|
||||||
(unsigned long)num_allocations);
|
num_allocations);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1957,7 +1950,7 @@ main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int kerror;
|
int kerror;
|
||||||
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
||||||
png_alloc_size_t allocation_now = current_allocation;
|
int allocation_now = current_allocation;
|
||||||
#endif
|
#endif
|
||||||
if (i == 1)
|
if (i == 1)
|
||||||
status_dots_requested = 1;
|
status_dots_requested = 1;
|
||||||
@ -2007,15 +2000,15 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
||||||
if (allocation_now != current_allocation)
|
if (allocation_now != current_allocation)
|
||||||
fprintf(STDERR, "MEMORY ERROR: %lu bytes lost\n",
|
fprintf(STDERR, "MEMORY ERROR: %d bytes lost\n",
|
||||||
(unsigned long)(current_allocation - allocation_now));
|
current_allocation - allocation_now);
|
||||||
|
|
||||||
if (current_allocation != 0)
|
if (current_allocation != 0)
|
||||||
{
|
{
|
||||||
memory_infop pinfo = pinformation;
|
memory_infop pinfo = pinformation;
|
||||||
|
|
||||||
fprintf(STDERR, "MEMORY ERROR: %lu bytes still allocated\n",
|
fprintf(STDERR, "MEMORY ERROR: %d bytes still allocated\n",
|
||||||
(unsigned long)current_allocation);
|
current_allocation);
|
||||||
|
|
||||||
while (pinfo != NULL)
|
while (pinfo != NULL)
|
||||||
{
|
{
|
||||||
@ -2027,14 +2020,14 @@ main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
||||||
fprintf(STDERR, " Current memory allocation: %20lu bytes\n",
|
fprintf(STDERR, " Current memory allocation: %10d bytes\n",
|
||||||
(unsigned long)current_allocation);
|
current_allocation);
|
||||||
fprintf(STDERR, " Maximum memory allocation: %20lu bytes\n",
|
fprintf(STDERR, " Maximum memory allocation: %10d bytes\n",
|
||||||
(unsigned long)maximum_allocation);
|
maximum_allocation);
|
||||||
fprintf(STDERR, " Total memory allocation: %20lu bytes\n",
|
fprintf(STDERR, " Total memory allocation: %10d bytes\n",
|
||||||
(unsigned long)total_allocation);
|
total_allocation);
|
||||||
fprintf(STDERR, " Number of allocations: %20lu\n",
|
fprintf(STDERR, " Number of allocations: %10d\n",
|
||||||
(unsigned long)num_allocations);
|
num_allocations);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2085,7 +2078,7 @@ main(void)
|
|||||||
fprintf(STDERR,
|
fprintf(STDERR,
|
||||||
" test ignored because libpng was not built with read support\n");
|
" test ignored because libpng was not built with read support\n");
|
||||||
/* And skip this test */
|
/* And skip this test */
|
||||||
return SKIP;
|
return PNG_LIBPNG_VER < 10600 ? 0 : 77;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
BIN
tests/badadler.png
Normal file
BIN
tests/badadler.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 67 B |
BIN
tests/badcrc.png
Normal file
BIN
tests/badcrc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 67 B |
@ -1,2 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
./pngtest --relaxed ${srcdir}/tests/badcrc.png
|
||||||
|
./pngtest --relaxed ${srcdir}/tests/badadler.png
|
||||||
exec ./pngtest --strict ${srcdir}/pngtest.png
|
exec ./pngtest --strict ${srcdir}/pngtest.png
|
||||||
|
Loading…
x
Reference in New Issue
Block a user