Skip to contentSkip to conversation

erofs-utils: fsck: fix an infinite loop of big pclusters

PATCH New Gao Xiang 1 participant 1 message May 11, 2023 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: fsck: fix an infinite loop of big pclusters

From: Gao Xiang <[email protected]>

Actually it's outdated code compared with kernel
commit b86269f43892 ("erofs: support parsing big pcluster compact indexes")

This will cause fsck.erofs works endlessly on some crafted images.

Fixes 418fb683fd96 ("erofs-utils: fsck: fix an infinite loop of big pcluster")
---
 lib/zmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/zmap.c +1 -1
index 7b0fd83..6d9b033 100644
@@ -322,7 +322,7 @@ static int unpack_compacted_index(struct z_erofs_maprecorder *m,
 					nblk += lo & ~Z_EROFS_VLE_DI_D0_CBLKCNT;
 					continue;
 				}
-				if (lo == 1) {
+				if (lo <= 1) {
 					DBG_BUGON(1);
 					/* --i; ++nblk;	continue; */
 					return -EFSCORRUPTED;
Signature · 1 line
2.30.2