changeset 11167:2a652a5b9daa

8211184: Improve JPEG processing Reviewed-by: kcr, prr, jdv Contributed-by: ambarish.rapte@oracle.com, philip.race@oracle.com
author arapte
date Thu, 18 Oct 2018 16:05:04 +0530
parents a62d3e85f745
children 4c654ceb8691
files modules/javafx.graphics/src/main/native-iio/libjpeg/jmemmgr.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/modules/javafx.graphics/src/main/native-iio/libjpeg/jmemmgr.c	Fri Oct 12 04:50:32 2018 -0700
+++ b/modules/javafx.graphics/src/main/native-iio/libjpeg/jmemmgr.c	Thu Oct 18 16:05:04 2018 +0530
@@ -403,6 +403,10 @@
   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));
@@ -451,6 +455,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));