View | Details | Raw Unified | Return to bug 36560 | Differences between
and this patch

Collapse All | Expand All

(-)java/util/zip/InflaterHuffmanTree.java (-2 / +6 lines)
Lines 95-105 Link Here
95
	  blCount[bits]++;
95
	  blCount[bits]++;
96
      }
96
      }
97
97
98
    int max = 0;
98
    int code = 0;
99
    int code = 0;
99
    int treeSize = 512;
100
    int treeSize = 512;
100
    for (int bits = 1; bits <= MAX_BITLEN; bits++)
101
    for (int bits = 1; bits <= MAX_BITLEN; bits++)
101
      {
102
      {
102
	nextCode[bits] = code;
103
	nextCode[bits] = code;
104
	if (blCount[bits] > 0)
105
	  max = bits;
103
	code += blCount[bits] << (16 - bits);
106
	code += blCount[bits] << (16 - bits);
104
	if (bits >= 10)
107
	if (bits >= 10)
105
	  {
108
	  {
Lines 109-117 Link Here
109
	    treeSize += (end - start) >> (16 - bits);
112
	    treeSize += (end - start) >> (16 - bits);
110
	  }
113
	  }
111
      }
114
      }
112
    if (code != 65536)
113
      throw new DataFormatException("Code lengths don't add up properly.");
114
115
116
    if (code != 65536 && max != 1)
117
      throw new DataFormatException("Code lengths don't add up properly. code = " + code);
118
115
    /* Now create and fill the extra tables from longest to shortest
119
    /* Now create and fill the extra tables from longest to shortest
116
     * bit len.  This way the sub trees will be aligned.
120
     * bit len.  This way the sub trees will be aligned.
117
     */
121
     */

Return to bug 36560