--- a/src/java.desktop/share/native/libjavajpeg/jmemmgr.c Mon Oct 08 12:55:04 2018 +0800
+++ b/src/java.desktop/share/native/libjavajpeg/jmemmgr.c Mon Oct 08 12:53:53 2018 -0700
@@ -406,6 +406,9 @@
JDIMENSION rowsperchunk, currow, i;
long ltemp;
+ if (samplesperrow == 0) {
+ ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
+ }
/* Calculate max # of rows allowed in one allocation chunk */
ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /
((long) samplesperrow * SIZEOF(JSAMPLE));
@@ -454,6 +457,10 @@
JDIMENSION rowsperchunk, currow, i;
long ltemp;
+ if (blocksperrow == 0) {
+ ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
+ }
+
/* Calculate max # of rows allowed in one allocation chunk */
ltemp = (MAX_ALLOC_CHUNK-SIZEOF(large_pool_hdr)) /
((long) blocksperrow * SIZEOF(JBLOCK));