diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index 27871f67c..acf2014b5 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -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; }