summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-01-20 23:00:00 +0100
committerDaniel Friesel <derf@finalrewind.org>2021-01-20 23:00:00 +0100
commitf6effe4934d4d97f255d119e8f95b91f14e70cb1 (patch)
tree5a658120d588d0af16a814801ff149feb5b7ffcb
parent252524c281387d9c661b8e5c544228b434364258 (diff)
udeflate: fix off-by-one in static huffman dictionary generation
-rw-r--r--src/lib/udeflate.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/lib/udeflate.cc b/src/lib/udeflate.cc
index 51be964..df7c179 100644
--- a/src/lib/udeflate.cc
+++ b/src/lib/udeflate.cc
@@ -314,19 +314,19 @@ static int8_t udeflate_static_huffman()
for (i = 256; i <= 279; i++) {
udeflate_lld_lengths[i] = 7;
}
- for (i = 280; i <= 284; i++) {
+ for (i = 280; i <= 285; i++) {
udeflate_lld_lengths[i] = 8;
}
- for (i = 285; i <= 285 + 29; i++) {
+ for (i = 286; i <= 286 + 29; i++) {
udeflate_lld_lengths[i] = 5;
}
- udeflate_build_alphabet(udeflate_lld_lengths, 285, udeflate_bl_count_ll,
+ udeflate_build_alphabet(udeflate_lld_lengths, 286, udeflate_bl_count_ll,
udeflate_next_code_ll);
- udeflate_build_alphabet(udeflate_lld_lengths + 285, 29,
+ udeflate_build_alphabet(udeflate_lld_lengths + 286, 29,
udeflate_bl_count_d, udeflate_next_code_d);
- return udeflate_huffman(udeflate_lld_lengths, 285,
- udeflate_lld_lengths + 285, 29);
+ return udeflate_huffman(udeflate_lld_lengths, 286,
+ udeflate_lld_lengths + 286, 29);
}
static int8_t udeflate_dynamic_huffman()