[libpng12] Added a safety check in png_set_tIME() (Bug report from Qixue Xiao).

This commit is contained in:
Glenn Randers-Pehrson
2015-10-23 08:44:51 -05:00
parent cfd5b1a23f
commit fbf0f02434
4 changed files with 24 additions and 9 deletions

View File

@@ -837,6 +837,15 @@ png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
(png_ptr->mode & PNG_WROTE_tIME))
return;
if (mod_time->month == 0 || mod_time->month > 12 ||
mod_time->day == 0 || mod_time->day > 31 ||
mod_time->hour > 23 || mod_time->minute > 59 ||
mod_time->second > 60)
{
png_warning(png_ptr, "Ignoring invalid time value");
return;
}
png_memcpy(&(info_ptr->mod_time), mod_time, png_sizeof(png_time));
info_ptr->valid |= PNG_INFO_tIME;
}