Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] erofs-utils: fsck: fix an infinite loop of big pclusters
@ 2023-05-11 14:15 Gao Xiang
  0 siblings, 0 replies; only message in thread
From: Gao Xiang @ 2023-05-11 14:15 UTC (permalink / raw)
  To: linux-erofs; +Cc: Gao Xiang, Chaoming Yang

From: Gao Xiang <hsiangkao@linux.alibaba.com>

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.

Reported-by: Chaoming Yang <lometsj@live.com>
Fixes: 418fb683fd96 ("erofs-utils: fsck: fix an infinite loop of big pcluster")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 lib/zmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/zmap.c b/lib/zmap.c
index 7b0fd83..6d9b033 100644
--- a/lib/zmap.c
+++ b/lib/zmap.c
@@ -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;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-11 14:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-11 14:15 [PATCH] erofs-utils: fsck: fix an infinite loop of big pclusters Gao Xiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox