From e393f1952728b96c551357e2aa38367c76b716ce Mon Sep 17 00:00:00 2001 From: John Bowler Date: Sun, 10 Jan 2016 13:49:34 -0800 Subject: [PATCH] Fix write problem with reduced size IDAT chunks png_set_compression_buffer_size would result in a spurious debug assert if the compression buffer size was set to something other than a multiple of PNG_ROW_BUFFER_SIZE; the debug test failed to add the buffer 'start' Signed-off-by: John Bowler --- pngwutil.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pngwutil.c b/pngwutil.c index c51b0e096..30a8f945a 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -2363,7 +2363,8 @@ png_write_IDAT(png_structrp png_ptr, int flush) else /* not end of list */ debug((ps->s.zs.next_out < next->output || ps->s.zs.next_out > next->output + sizeof next->output) && - (ps->s.overflow > 0 || ps->s.len >= sizeof next->output)); + (ps->s.overflow > 0 || + ps->s.start + ps->s.len >= sizeof next->output)); /* First, if this is the very first IDAT (PNG_HAVE_IDAT not set) * optimize the CINFO field: @@ -2419,7 +2420,6 @@ png_write_IDAT(png_structrp png_ptr, int flush) written = len; png_write_chunk_data(png_ptr, next->output+start, written); ps->s.start = (unsigned int)/*SAFE*/(start + written); - UNTESTED } /* 'written' bytes were written: */