changeset 13375:baa7a736796b

8210866: Improve JPEG processing Reviewed-by: serb, psadhukhan, rhalade
author prr
date Mon, 08 Oct 2018 15:24:21 -0700
parents e2f366716adf
children d0d0b71e3a2a
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	Mon Oct 08 21:55:26 2018 +0100
+++ 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));