[libpng16] Only mark text chunks as written after successfully writing them.

This commit is contained in:
Glenn Randers-Pehrson 2014-10-05 13:45:38 -05:00
parent f56c00f050
commit a11cd84160
5 changed files with 19 additions and 6 deletions

View File

@ -61,8 +61,12 @@ Version 1.6.14beta06 [October 5, 2014]
Replaced repeated code in pngpread.c with PNG_PUSH_SAVE_BUFFER_IF_FULL.
Added "chunk iTXt enables TEXT" and "chunk zTXt enables TEXT"
to pnglibconf.dfa.
Removed "option READ_COMPRESSED_TEXT enables READ_TEXT" from pnglibconf.dfa,
to make it possible to configure a libpng that supports iCCP but not TEXT.
Version 1.6.14beta07 [October 5, 2014]
Removed "option WRITE_COMPRESSED_TEXT enables WRITE_TEXT" from pnglibconf.dfa
Only mark text chunks as written after successfully writing them.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -5014,8 +5014,12 @@ Version 1.6.14beta06 [October 5, 2014]
Replaced repeated code in pngpread.c with PNG_PUSH_SAVE_BUFFER_IF_FULL.
Added "chunk iTXt enables TEXT" and "chunk zTXt enables TEXT"
to pnglibconf.dfa.
Removed "option READ_COMPRESSED_TEXT enables READ_TEXT" from pnglibconf.dfa,
to make it possible to configure a libpng that supports iCCP but not TEXT.
Version 1.6.14beta07 [October 5, 2014]
Removed "option WRITE_COMPRESSED_TEXT enables WRITE_TEXT" from pnglibconf.dfa
Only mark text chunks as written after successfully writing them.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit

View File

@ -932,7 +932,7 @@ void write_png(char *file_name /* , ... other image information ... */)
*/
/* Once we write out the header, the compression type on the text
* chunks gets changed to PNG_TEXT_COMPRESSION_NONE_WR or
* chunk gets changed to PNG_TEXT_COMPRESSION_NONE_WR or
* PNG_TEXT_COMPRESSION_zTXt_WR, so it doesn't get written out again
* at the end.
*/

View File

@ -396,6 +396,7 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
row_info.pixel_depth = png_ptr->pixel_depth;
row_info.rowbytes = PNG_ROWBYTES(row_info.pixel_depth, row_info.width);
#ifdef PNG_WARNINGS_SUPPORTED
if (png_ptr->row_number == 0 && png_ptr->pass == 0)
{
/* Check for transforms that have been set but were defined out */
@ -435,6 +436,7 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
png_warning(png_ptr, "PNG_READ_SWAP_SUPPORTED is not defined");
#endif
}
#endif /* PNG_WARNINGS_SUPPORTED */
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* If interlaced and we do not need a new row, combine row and return.

View File

@ -292,11 +292,14 @@ png_write_info(png_structrp png_ptr, png_const_inforp info_ptr)
info_ptr->text[i].lang,
info_ptr->text[i].lang_key,
info_ptr->text[i].text);
/* Mark this chunk as written */
if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE)
info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR;
else
info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR;
#else
png_warning(png_ptr, "Unable to write international text");
png_warning(png_ptr, "Unable to write international text");
#endif
/* Mark this chunk as written */
info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR;
}
/* If we want a compressed text chunk */
@ -306,11 +309,11 @@ png_write_info(png_structrp png_ptr, png_const_inforp info_ptr)
/* Write compressed chunk */
png_write_zTXt(png_ptr, info_ptr->text[i].key,
info_ptr->text[i].text, info_ptr->text[i].compression);
/* Mark this chunk as written */
info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR;
#else
png_warning(png_ptr, "Unable to write compressed text");
#endif
/* Mark this chunk as written */
info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_zTXt_WR;
}
else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE)