aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/java/util/zip/InflaterHuffmanTree.java
diff options
context:
space:
mode:
authorAndrew John Hughes <gandalf@gcc.gnu.org>2012-03-23 15:19:26 +0000
committerAndrew John Hughes <gandalf@gcc.gnu.org>2012-03-23 15:19:26 +0000
commit0563022a206294757effa44686727bffc4f7c2bd (patch)
treefebe3d4d4c0c994db223fee8e819bde6582494c9 /libjava/classpath/java/util/zip/InflaterHuffmanTree.java
parent21669dfe20db0246ece395db5558a081a5c7088f (diff)
downloadgcc-0563022a206294757effa44686727bffc4f7c2bd.zip
gcc-0563022a206294757effa44686727bffc4f7c2bd.tar.gz
gcc-0563022a206294757effa44686727bffc4f7c2bd.tar.bz2
Merge GNU Classpath 0.99 into libjava.
From-SVN: r185741
Diffstat (limited to 'libjava/classpath/java/util/zip/InflaterHuffmanTree.java')
-rw-r--r--libjava/classpath/java/util/zip/InflaterHuffmanTree.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/libjava/classpath/java/util/zip/InflaterHuffmanTree.java b/libjava/classpath/java/util/zip/InflaterHuffmanTree.java
index c12c732..1a152d2 100644
--- a/libjava/classpath/java/util/zip/InflaterHuffmanTree.java
+++ b/libjava/classpath/java/util/zip/InflaterHuffmanTree.java
@@ -95,11 +95,14 @@ class InflaterHuffmanTree
blCount[bits]++;
}
+ int max = 0;
int code = 0;
int treeSize = 512;
for (int bits = 1; bits <= MAX_BITLEN; bits++)
{
nextCode[bits] = code;
+ if (blCount[bits] > 0)
+ max = bits;
code += blCount[bits] << (16 - bits);
if (bits >= 10)
{
@@ -109,8 +112,8 @@ class InflaterHuffmanTree
treeSize += (end - start) >> (16 - bits);
}
}
- if (code != 65536)
- throw new DataFormatException("Code lengths don't add up properly.");
+ if (code != 65536 && max > 1)
+ throw new DataFormatException("incomplete dynamic bit lengths tree");
/* Now create and fill the extra tables from longest to shortest
* bit len. This way the sub trees will be aligned.