Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,8 @@ if(PNG_TESTS AND PNG_SHARED)
list(SORT PNGSUITE_PNGS)
file(GLOB TEST_PNGS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/testpngs/*.png")
list(SORT TEST_PNGS)
file(GLOB TEST_APNG_PNGS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/testpngs/apng/*.png")
list(SORT TEST_APNG_PNGS)
file(GLOB TEST_PNG3_PNGS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/testpngs/png-3/*.png")
list(SORT TEST_PNG3_PNGS)

Expand All @@ -555,6 +557,11 @@ if(PNG_TESTS AND PNG_SHARED)
COMMAND pngtest
FILES "${TEST_PNG3_PNGS}")

png_add_test(NAME pngtest-apng
COMMAND pngtest
OPTIONS --relaxed
FILES "${TEST_APNG_PNGS}")

# pnggetset test:
# Getter-to-setter roundtrips for various chunk types.
add_executable(pnggetset ${pnggetset_sources})
Expand Down
Binary file added contrib/testpngs/apng/frame-size-change.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions pngwutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -2886,6 +2886,21 @@ png_write_reset(png_struct *png_ptr)
png_ptr->row_number = 0;
png_ptr->pass = 0;
png_ptr->mode &= ~PNG_HAVE_IDAT;

/* APNG frames may have different dimensions, so the row and filter
* buffers are frame-local and must be recreated for each new frame.
*/
png_free(png_ptr, png_ptr->row_buf);
png_ptr->row_buf = NULL;

#ifdef PNG_WRITE_FILTER_SUPPORTED
png_free(png_ptr, png_ptr->prev_row);
png_free(png_ptr, png_ptr->try_row);
png_free(png_ptr, png_ptr->tst_row);
png_ptr->prev_row = NULL;
png_ptr->try_row = NULL;
png_ptr->tst_row = NULL;
#endif
}

void /* PRIVATE */
Expand Down
3 changes: 3 additions & 0 deletions tests/pngtest-all
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ TEST --strict "${srcdir}"/pngtest.png
# PNG-3 tests
TEST --strict "${srcdir}"/contrib/testpngs/png-3/*.png

# APNG tests
TEST --relaxed "${srcdir}"/contrib/testpngs/apng/*.png

# Various crashers
# Use --relaxed because some come from fuzzers that don't maintain CRCs
TEST --relaxed "${srcdir}"/contrib/testpngs/crashers/badcrc.png
Expand Down