Skip to contentSkip to conversation

erofs-utils: lib: limit NONHEAD delta1 for compact indexes

PATCH New Gao Xiang 1 participant 1 message Jan 21, 2025 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 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")
---
 lib/compress.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/compress.c +1 -1
index 94a9d52..5c9c051 100644
@@ -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];
 			}
Signature · 1 line
2.43.5