# HG changeset patch # User prr # Date 1539028433 25200 # Node ID b9149d907610af2111ab8d72fa41eada99458fd9 # Parent e8bae92beee30001ad7c448513ea207bf6168509 8210866: Improve JPEG processing Reviewed-by: serb, psadhukhan, rhalade diff -r e8bae92beee3 -r b9149d907610 src/java.desktop/share/native/libjavajpeg/jmemmgr.c --- 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));