Signed-off-by: Young_X <YangX92@hotmail.com>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
+#include <limits.h>
#ifdef OPJ_HAVE_LIBTIFF
#include <tiffio.h>
return NULL;
}
+ /* This limitation could be removed by making sure to use size_t below */
+ if (header_info.height != 0 &&
+ header_info.width > INT_MAX / header_info.height) {
+ fprintf(stderr, "pnmtoimage:Image %dx%d too big!\n",
+ header_info.width, header_info.height);
+ fclose(fp);
+ return NULL;
+ }
+
format = header_info.format;
switch (format) {