[PATCH] erofs-utils: lib: fix potential overflow issue
    Hongzhen Luo 
    hongzhen at linux.alibaba.com
       
    Tue Aug 13 22:10:23 AEST 2024
    
    
  
Coverity-id: 502353
Change 8U to 8ULL to avoid arithmetic multiplication overflow.
Signed-off-by: Hongzhen Luo <hongzhen at linux.alibaba.com>
---
 lib/kite_deflate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/kite_deflate.c b/lib/kite_deflate.c
index 8581834..4b1068b 100644
--- a/lib/kite_deflate.c
+++ b/lib/kite_deflate.c
@@ -892,7 +892,7 @@ static bool deflate_count_code(struct kite_deflate *s, bool literal,
 {
 	struct kite_deflate_table *t = s->tab;
 	unsigned int lenbase = (literal ? 0 : kSymbolMatch);
-	u64 rem = (s->outlen - s->pos_out) * 8 - s->bitpos;
+	u64 rem = (s->outlen - s->pos_out) * 8ULL - s->bitpos;
 	bool recalc = false;
 	unsigned int bits;
 
-- 
2.43.5
    
    
More information about the Linux-erofs
mailing list