diff options
author | John Bowler <jbowler@acm.org> | 2011-05-05 17:35:39 -0500 |
---|---|---|
committer | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2011-05-05 17:35:39 -0500 |
commit | c5bef946b1c247f22768eded4525cc872976653a (patch) | |
tree | c9b07b2ffbe15a7f5f9b469a51993ddf45b9eb63 /pngerror.c | |
parent | c559bb58ed25ae0d6b732283afeaabb36e4b430f (diff) | |
download | libpng-c5bef946b1c247f22768eded4525cc872976653a.tar.gz |
[devel] IDAT compression failed if preceded by a compressed text chunk
This was because the attempt to reset the zlib stream in png_write_IDAT
happened after the first IDAT chunk had been deflated - much too late.
In this change internal functions are added to claim/release the z_stream
and, hopefully, make the code more robust. Also deflateEnd checking is
added - previously libpng would ignore an error at the end of the stream.
Diffstat (limited to 'pngerror.c')
-rw-r--r-- | pngerror.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pngerror.c b/pngerror.c index 20160cf27..eef4ec4f4 100644 --- a/pngerror.c +++ b/pngerror.c @@ -102,7 +102,6 @@ png_err,(png_structp png_ptr),PNG_NORETURN) } #endif /* PNG_ERROR_TEXT_SUPPORTED */ -#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_TIME_RFC1123_SUPPORTED) /* Utility to safely appends strings to a buffer. This never errors out so * error checking is not required in the caller. */ @@ -112,8 +111,9 @@ png_safecat(png_charp buffer, size_t bufsize, size_t pos, { if (buffer != NULL && pos < bufsize) { - if (string != NULL) while (*string != '\0' && pos < bufsize-1) - buffer[pos++] = *string++; + if (string != NULL) + while (*string != '\0' && pos < bufsize-1) + buffer[pos++] = *string++; buffer[pos] = '\0'; } @@ -121,6 +121,7 @@ png_safecat(png_charp buffer, size_t bufsize, size_t pos, return pos; } +#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_TIME_RFC1123_SUPPORTED) /* Utility to dump an unsigned value into a buffer, given a start pointer and * and end pointer (which should point just *beyond* the end of the buffer!) * Returns the pointer to the start of the formatted string. |