diff --git a/Libs/lpng163/pngrutil.c b/Libs/lpng163/pngrutil.c index a4fa714..486ac56 100644 --- a/Libs/lpng163/pngrutil.c +++ b/Libs/lpng163/pngrutil.c @@ -3158,10 +3158,13 @@ png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length) else { size_t row_factor = - (png_ptr->width * png_ptr->channels * (png_ptr->bit_depth > 8? 2: 1) - + 1 + (png_ptr->interlaced? 6: 0)); + (size_t)png_ptr->width + * (size_t)png_ptr->channels + * (png_ptr->bit_depth > 8? 2: 1) + + 1 + + (png_ptr->interlaced? 6: 0); if (png_ptr->height > PNG_UINT_32_MAX/row_factor) - limit=PNG_UINT_31_MAX; + limit = PNG_UINT_31_MAX; else limit = png_ptr->height * row_factor; limit += 6 + 5*(limit/32566+1); /* zlib+deflate overhead */