8200052: libjavajpeg: Fix compile warning in jchuff.c
Reviewed-by: prr
Contributed-by: adam.farley@uk.ibm.com, thomas.stuefe@sap.com
--- 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 */