From: Gao Xiang Date: Tue, 21 Jan 2025 13:08:25 +0000 (+0800) Subject: erofs-utils: lib: limit NONHEAD delta1 for compact indexes X-Git-Tag: accepted/tizen/unified/20250610.081809~65 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e42b2fbb161b2341215c3b35aec833ecf4ec464;p=platform%2Fupstream%2Ferofs-utils.git erofs-utils: lib: limit NONHEAD delta1 for compact indexes Otherwise it could be identified as a CBLKCNT lcluster. It actually has no real impact for 4 KiB lclusters (blocks) since EROFS_CONFIG_COMPR_MAX_SZ == 4 MiB and Z_EROFS_LI_D0_CBLKCNT means 2048 * 4KiB == 8 MiB. Fixes: 0917ff150846 ("erofs-utils: fix delta[1] out-of-bound of compact indexes") Fixes: 2f871035cca6 ("erofs-utils: mkfs: support compact indexes for bigpcluster") Signed-off-by: Gao Xiang Link: https://lore.kernel.org/r/20250121130825.1722009-1-hsiangkao@linux.alibaba.com --- diff --git a/lib/compress.c b/lib/compress.c index 20ab208..56b8c9b 100644 --- a/lib/compress.c +++ b/lib/compress.c @@ -839,7 +839,7 @@ static void *write_compacted_indexes(u8 *out, *dummy_head = false; } else if (i + 1 == vcnt) { offset = min_t(u16, cv[i].u.delta[1], - (1 << lobits) - 1); + Z_EROFS_LI_D0_CBLKCNT - 1); } else { offset = cv[i].u.delta[0]; }