[PATCH] erofs-utils: lib: fix maximum huffman length for kite-deflate
Gao Xiang
hsiangkao at linux.alibaba.com
Fri Apr 11 04:33:31 AEST 2025
It should be kTableDirectLevels - 1 (15) instead of 16; otherwise,
it will be incorrectly identified as kBitLensRepNumber_3_6.
Reported-by: Bo Liu <liubo03 at inspur.com>
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
lib/kite_deflate.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/kite_deflate.c b/lib/kite_deflate.c
index 592c4d1..7e92c7c 100644
--- a/lib/kite_deflate.c
+++ b/lib/kite_deflate.c
@@ -52,6 +52,8 @@ unsigned long erofs_memcmp2(const u8 *s1, const u8 *s2,
#define kBitLens0Number_3_10 (kBitLensRepNumber_3_6 + 1)
#define kBitLens0Number_11_138 (kBitLens0Number_3_10 + 1)
+#define kMaxLen (kTableDirectLevels - 1)
+
static u32 kstaticHuff_mainCodes[kFixedLenTableSize];
static const u8 kstaticHuff_litLenLevels[kFixedLenTableSize] = {
[0 ... 143] = 8, [144 ... 255] = 9,
@@ -180,8 +182,6 @@ static void flushbits(struct kite_deflate *s)
s->inflightbits = 0;
}
-#define kMaxLen 16
-
static void deflate_genhuffcodes(const u8 *lens, u32 *p, unsigned int nr_codes,
const u32 *bl_count)
{
--
2.43.5
More information about the Linux-erofs
mailing list