From 39d99e13b7e8233a9ce9fc6d9fd425829426525b Mon Sep 17 00:00:00 2001 From: glennrp Date: Sun, 26 Oct 2014 20:57:13 +0000 Subject: [PATCH] Log fact that image->taint is reason for resetting tIME chunk data. --- coders/png.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/coders/png.c b/coders/png.c index 0c93daa9d..b4130f6d9 100644 --- a/coders/png.c +++ b/coders/png.c @@ -3103,11 +3103,11 @@ static Image *ReadOnePNGImage(MngInfo *mng_info, (void) SetImageProperty(image,"png:PLTE.number_colors",msg, exception); } - + } #if defined(PNG_tIME_SUPPORTED) - read_tIME_chunk(image,ping,ping_info,exception); + read_tIME_chunk(image,ping,ping_info,exception); #endif - } + /* Read image scanlines. @@ -10690,18 +10690,27 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info, const char *timestamp; - timestamp=GetImageOption(image_info,"png:tIME"); - if (timestamp != (const char *) NULL) - write_tIME_chunk(image,ping,ping_info,timestamp,exception); - else + if (image->taint == MagickFalse) { - if (image->taint == MagickFalse) + timestamp=GetImageOption(image_info,"png:tIME"); + + if (timestamp == (const char *) NULL) timestamp=GetImageProperty(image,"png:tIME",exception); - write_tIME_chunk(image,ping,ping_info,timestamp,exception); } + + else + { + (void) LogMagickEvent(CoderEvent,GetMagickModule(), + " Reset tIME in tainted image"); + + timestamp=GetImageProperty(image,"date:modify",exception); + } + + if (timestamp != (const char *) NULL) + write_tIME_chunk(image,ping,ping_info,timestamp,exception); } #endif - + if (mng_info->need_blob != MagickFalse) { if (OpenBlob(image_info,image,WriteBinaryBlobMode,exception) == -- 2.40.0