erofs-utils: lib: fix maximum huffman length for kite-deflate
PATCH 1/1 erofs-utils: lib: fix maximum huffman length for kite-deflate
It should be kTableDirectLevels - 1 (15) instead of 16; otherwise, it will be incorrectly identified as kBitLensRepNumber_3_6.
Reported-by Bo Liu <[email protected]>
Signed-off-by Gao Xiang <[email protected]>
--- lib/kite_deflate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/kite_deflate.c +2 -2
@@ -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) {
Signature · 1 line
2.43.5
Quoted 1 line · Gao Xiang
It should be kTableDirectLevels - 1 (15) instead of 16; otherwise, it will
be
Quoted 4 lines
incorrectly identified as
kBitLensRepNumber_3_6.Reported-by Bo Liu <[email protected]>Signed-off-by Gao Xiang <[email protected]>
Tested-by Bo Liu <[email protected]>
Thanks.