pictureviewer: fix possible integer_overflow

This commit is contained in:
Jacek Jendrzej
2020-02-02 14:09:47 +01:00
parent 0df5781246
commit 97381484ce

View File

@@ -878,7 +878,11 @@ unsigned char * CPictureViewer::int_Resize(unsigned char *orgin, int ox, int oy,
unsigned char * cr; unsigned char * cr;
if(dst == NULL) 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)){ if (!checkfreemem(bufsize)){
return orgin; return orgin;
} }