changeset 9695:d541364c9376

8210866: Improve JPEG processing Reviewed-by: serb, psadhukhan, rhalade
author prr
date Mon, 08 Oct 2018 15:24:21 -0700
parents 1636cb164608
children 9e7b93facf9a
files src/share/native/sun/awt/image/jpeg/jmemmgr.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/native/sun/awt/image/jpeg/jmemmgr.c	Sat Oct 06 12:27:18 2018 -0700
+++ b/src/share/native/sun/awt/image/jpeg/jmemmgr.c	Mon Oct 08 15:24:21 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));