changeset 53357:b9149d907610

8210866: Improve JPEG processing Reviewed-by: serb, psadhukhan, rhalade
author prr
date Mon, 08 Oct 2018 12:53:53 -0700
parents e8bae92beee3
children ab474ef0a0ac
files src/java.desktop/share/native/libjavajpeg/jmemmgr.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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));