pictureviewer: fix possible integer_overflow

Origin commit data
------------------
Commit: eba5864fb2
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2020-02-02 (Sun, 02 Feb 2020)
This commit is contained in:
Jacek Jendrzej
2020-02-02 21:26:35 +01:00
committed by vanhofen
parent ba505caa67
commit 9f5489c3ab

View File

@@ -902,7 +902,11 @@ unsigned char * CPictureViewer::int_Resize(unsigned char *orgin, int ox, int oy,
unsigned char * cr;
if(dst == NULL)
{
size_t bufsize = dx * dy * ((alpha) ? 4 : 3);
int ai = ((alpha) ? 4 : 3);
if (dy <= 1 || dx <= 1 || (dx *ai > INT_MAX / dy))
return orgin;
size_t bufsize = dx * dy * ai;
if (!checkfreemem(bufsize)){
return orgin;
}