From 7974d60f54240205b94cce30d4f88b217880f155 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sun, 5 Oct 2014 16:25:17 -0500 Subject: [PATCH] [libpng17] Merge with libpng-1.6.14beta07 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. Removed "option WRITE_COMPRESSED_TEXT enables WRITE_TEXT" from pnglibconf.dfa Only mark text chunks as written after successfully writing them. --- ANNOUNCE | 8 ++++++-- CHANGES | 6 +++++- example.c | 2 +- pngread.c | 2 ++ pngwrite.c | 13 ++++++++----- scripts/pnglibconf.dfa | 7 +++---- 6 files changed, 25 insertions(+), 13 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 813eeaa4a..2593c56ce 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.7.0beta38 - October 4, 2014 +Libpng 1.7.0beta38 - October 5, 2014 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -602,7 +602,7 @@ Version 1.7.0beta36 [September 27, 2014] Version 1.7.0beta37 [September 28, 2014] Merged scripts/*, pngvalid.c and pngfix.c with libpng-1.6.14beta04. -Version 1.7.0beta38 [October 4, 2014] +Version 1.7.0beta38 [October 5, 2014] Added "option READ_iCCP enables READ_COMPRESSED_TEXT" to pnglibconf.dfa Removed unused "text_len" parameter from private function png_write_zTXt(). Conditionally compile some code in png_deflate_claim(), when @@ -610,6 +610,10 @@ Version 1.7.0beta38 [October 4, 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. + 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 diff --git a/CHANGES b/CHANGES index 7dc0ff5e6..9b9af55e4 100644 --- a/CHANGES +++ b/CHANGES @@ -4891,7 +4891,7 @@ Version 1.7.0beta36 [September 27, 2014] Version 1.7.0beta37 [September 28, 2014] Merged scripts/*, pngvalid.c and pngfix.c with libpng-1.6.14beta04. -Version 1.7.0beta38 [October 4, 2014] +Version 1.7.0beta38 [October 5, 2014] Added "option READ_iCCP enables READ_COMPRESSED_TEXT" to pnglibconf.dfa Removed unused "text_len" parameter from private function png_write_zTXt(). Conditionally compile some code in png_deflate_claim(), when @@ -4899,6 +4899,10 @@ Version 1.7.0beta38 [October 4, 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. + 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 diff --git a/example.c b/example.c index 574592d9f..a0229e8e1 100644 --- a/example.c +++ b/example.c @@ -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. */ diff --git a/pngread.c b/pngread.c index bc80bc2f4..8b667fdf1 100644 --- a/pngread.c +++ b/pngread.c @@ -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. diff --git a/pngwrite.c b/pngwrite.c index 2a47f0e53..6fb46b84f 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -297,11 +297,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 */ @@ -311,11 +314,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) diff --git a/scripts/pnglibconf.dfa b/scripts/pnglibconf.dfa index c615cc1ee..02db9ecf2 100644 --- a/scripts/pnglibconf.dfa +++ b/scripts/pnglibconf.dfa @@ -381,7 +381,7 @@ option IO_STATE option USER_LIMITS requires READ -# If the following settings are *not* set libpng will not limit the size of +# If these settings are *not* set libpng will not limit the size of # images or the size of data in ancilliary chunks. This does lead to # security issues if PNG files come from untrusted sources. Settings have the # following interpretations: @@ -395,8 +395,8 @@ option USER_LIMITS requires READ # USER_CHUNK_CACHE_MAX limit setting USER_WIDTH_MAX setting USER_HEIGHT_MAX -setting USER_CHUNK_MALLOC_MAX setting USER_CHUNK_CACHE_MAX +setting USER_CHUNK_MALLOC_MAX # To default all these settings to values that are large but probably # safe turn the SAFE_LIMITS option on; this will cause the value in @@ -406,7 +406,7 @@ option SAFE_LIMITS enables USER_LIMITS disabled = SAFE_LIMITS SAFE_LIMITS # If this option is enabled APIs to set the above limits at run time are added; -# without these the hardwired (compile time) limits will be used. +# without this the hardwired (compile time) limits will be used. option SET_USER_LIMITS requires USER_LIMITS # All of the following options relate to code capabilities for @@ -847,7 +847,6 @@ option WRITE_COMPRESSED_TEXT disabled option WRITE_iCCP enables WRITE_COMPRESSED_TEXT option WRITE_iTXt enables WRITE_COMPRESSED_TEXT option WRITE_zTXt enables WRITE_COMPRESSED_TEXT -option WRITE_COMPRESSED_TEXT enables WRITE_TEXT # Turn this off to disable png_read_png() and png_write_png() and # leave the row_pointers member out of the info structure.