diff options
author | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2017-06-06 18:40:45 -0500 |
---|---|---|
committer | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2017-06-06 18:40:45 -0500 |
commit | c5483289049d062be9ee975833a38b4e8575ee43 (patch) | |
tree | d5ed5ebe3923559d29605f6c115309db76137bac /pngwutil.c | |
parent | 11629b1c1a747693d7f6534c6c370c5d7edd7a84 (diff) |
[libpng16] Avoid writing an empty IDAT when the last IDAT exactly fills the
compression buffer (bug report by Brian Baird). This bug was introduced in
libpng-1.6.0.
Diffstat (limited to 'pngwutil.c')
-rw-r--r-- | pngwutil.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pngwutil.c b/pngwutil.c index 0f98d582d..21cfcf4ec 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -1003,7 +1003,8 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input, optimize_cmf(data, png_image_size(png_ptr)); #endif - png_write_complete_chunk(png_ptr, png_IDAT, data, size); + if (size) + png_write_complete_chunk(png_ptr, png_IDAT, data, size); png_ptr->mode |= PNG_HAVE_IDAT; png_ptr->zstream.next_out = data; @@ -1049,7 +1050,8 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input, optimize_cmf(data, png_image_size(png_ptr)); #endif - png_write_complete_chunk(png_ptr, png_IDAT, data, size); + if (size) + png_write_complete_chunk(png_ptr, png_IDAT, data, size); png_ptr->zstream.avail_out = 0; png_ptr->zstream.next_out = NULL; png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT; |