mirror of
https://github.com/google/brotli.git
synced 2024-11-22 11:40:06 +00:00
Fix a bug in ReadHuffmanCode().
This commit is contained in:
parent
3cd3a1066a
commit
10aaa83ffe
@ -88,6 +88,7 @@ void BrotliBuildCodeLengthsHuffmanTable(HuffmanCode* table,
|
||||
offset[bits] = symbol;
|
||||
bits++;
|
||||
});
|
||||
/* Symbols with code length 0 are placed after all other symbols. */
|
||||
offset[0] = 17;
|
||||
|
||||
/* sort symbols by length, by symbol order within each length */
|
||||
@ -101,8 +102,8 @@ void BrotliBuildCodeLengthsHuffmanTable(HuffmanCode* table,
|
||||
|
||||
table_size = 1 << BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH;
|
||||
|
||||
/* special case code with only one value */
|
||||
if (offset[BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH] == 0) {
|
||||
/* Special case: all symbols but one have 0 code length. */
|
||||
if (offset[0] == 0) {
|
||||
code.bits = 0;
|
||||
code.value = (uint16_t)sorted[0];
|
||||
for (key = 0; key < table_size; ++key) {
|
||||
|
Loading…
Reference in New Issue
Block a user