From eb2fa6132bc93a2b75a07d6bc915d89b83e83d0d Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sun, 20 Aug 2017 15:48:19 -0400 Subject: [PATCH] Handle short months in png_write_iTIME() --- coders/png.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/coders/png.c b/coders/png.c index 8eedbeaa8..3604ed570 100644 --- a/coders/png.c +++ b/coders/png.c @@ -8202,7 +8202,16 @@ static void write_tIME_chunk(Image *image,png_struct *ping,png_info *info, { /* wrong for short months */ ptime.month--; - ptime.day=31; + if(ptime.month == 2) + ptime.day=28; + else + { + if(ptime.month == 4 || ptime.month == 6 || ptime.month == 9 || + ptime.month == 11) + ptime.day=30; + else + ptime.day=31; + } } if (ptime.month == 0) { -- 2.50.1