diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2011-11-16 15:43:17 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2011-11-16 15:43:17 +0000 |
commit | 580b8fddcdaa6de9cd5dfcaff96be5a613713777 (patch) | |
tree | 8f3a154ff5490d19e71637de396672b419b6ce1a /converter/other/pngtopam.c | |
parent | 56accb4d73ff590200ceb6a22b4ca3536202f6bd (diff) | |
download | netpbm-mirror-580b8fddcdaa6de9cd5dfcaff96be5a613713777.tar.gz netpbm-mirror-580b8fddcdaa6de9cd5dfcaff96be5a613713777.tar.xz netpbm-mirror-580b8fddcdaa6de9cd5dfcaff96be5a613713777.zip |
Fix array bounds checking for tIME chunk
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1596 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other/pngtopam.c')
-rw-r--r-- | converter/other/pngtopam.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/converter/other/pngtopam.c b/converter/other/pngtopam.c index 21bc7f82..4789d6d8 100644 --- a/converter/other/pngtopam.c +++ b/converter/other/pngtopam.c @@ -573,13 +573,20 @@ showTime(struct pngx * const pngxP) { "July", "August", "September", "October", "November", "December" }; - pm_message("modification time: %02d %s %d %02d:%02d:%02d", - modTime.day, - month[modTime.month], - modTime.year, - modTime.hour, - modTime.minute, - modTime.second); + if (modTime.month < 1 || modTime.month >= ARRAY_SIZE(month)) { + pm_message("tIME chunk in PNG input is invalid; " + "modification time of image is unknown. " + "The month value, which should be in the range " + "1-12, is %u", modTime.month); + } else { + pm_message("modification time: %02d %s %d %02d:%02d:%02d", + modTime.day, + month[modTime.month], + modTime.year, + modTime.hour, + modTime.minute, + modTime.second); + } } } |