From: Yue Hu <[email protected]> Keep in sync with the kernel commit c505feba4c0d ("erofs: validate the extent length for uncompressed pclusters"), so that we can catch the issue as well in fuse.
Signed-off-by: Yue Hu <[email protected]> --- lib/zmap.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/zmap.c b/lib/zmap.c index 89e9da1..69b468d 100644 --- a/lib/zmap.c +++ b/lib/zmap.c @@ -647,6 +647,11 @@ static int z_erofs_do_map_blocks(struct erofs_inode *vi, } if (m.headtype == Z_EROFS_VLE_CLUSTER_TYPE_PLAIN) { + if (map->m_llen > map->m_plen) { + DBG_BUGON(1); + err = -EFSCORRUPTED; + goto out; + } if (vi->z_advise & Z_EROFS_ADVISE_INTERLACED_PCLUSTER) map->m_algorithmformat = Z_EROFS_COMPRESSION_INTERLACED; -- 2.17.1
