[PATCH] erofs-utils: lib: limit NONHEAD delta1 for compact indexes

Gao Xiang hsiangkao at linux.alibaba.com
Wed Jan 22 00:08:25 AEDT 2025


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 <hsiangkao at linux.alibaba.com>
---
 lib/compress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/compress.c b/lib/compress.c
index 94a9d52..5c9c051 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];
 			}
-- 
2.43.5



More information about the Linux-erofs mailing list