mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[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.
This commit is contained in:
committed by
Glenn Randers-Pehrson
parent
c559bb58ed
commit
c5bef946b1
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user