diff options
Diffstat (limited to 'brotli/enc/entropy_encode.cc')
-rw-r--r-- | brotli/enc/entropy_encode.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/brotli/enc/entropy_encode.cc b/brotli/enc/entropy_encode.cc index ad9f0f5..e4c6b20 100644 --- a/brotli/enc/entropy_encode.cc +++ b/brotli/enc/entropy_encode.cc @@ -352,6 +352,12 @@ void WriteHuffmanTree(const uint8_t* depth, const int length, } i += reps; } + // Throw away trailing zeros. + for (; *huffman_tree_size > 0; --(*huffman_tree_size)) { + if (tree[*huffman_tree_size - 1] > 0 && tree[*huffman_tree_size - 1] < 17) { + break; + } + } } namespace { |