changeset 50965:071f1fe0df5f

8200052: libjavajpeg: Fix compile warning in jchuff.c Reviewed-by: prr Contributed-by: adam.farley@uk.ibm.com, thomas.stuefe@sap.com
author prr
date Fri, 01 Jun 2018 09:16:36 -0700
parents 8fbbd19bf3a1
children 86ac3ffaf991
files src/java.desktop/share/native/libjavajpeg/jchuff.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/share/native/libjavajpeg/jchuff.c	Wed May 30 15:01:36 2018 +0200
+++ b/src/java.desktop/share/native/libjavajpeg/jchuff.c	Fri Jun 01 09:16:36 2018 -0700
@@ -805,8 +805,11 @@
   for (i = MAX_CLEN; i > 16; i--) {
     while (bits[i] > 0) {
       j = i - 2;                /* find length of new prefix to be used */
-      while (bits[j] == 0)
+      while (bits[j] == 0) {
+        if (j == 0)
+          ERREXIT(cinfo, JERR_HUFF_CLEN_OVERFLOW);
         j--;
+      }
 
       bits[i] -= 2;             /* remove two symbols */
       bits[i-1]++;              /* one goes in this length */