1
0
Fork 0
alistair23-linux/fs/erofs
Gao Xiang aa99a76b40 erofs: handle corrupted images whose decompressed size less than it'd be
As Lasse pointed out, "Looking at fs/erofs/decompress.c,
the return value from LZ4_decompress_safe_partial is only
checked for negative value to catch errors. ... So if
I understood it correctly, if there is bad data whose
uncompressed size is much less than it should be, it can
leave part of the output buffer untouched and expose the
previous data as the file content. "

Let's fix it now.

Cc: Lasse Collin <lasse.collin@tukaani.org>
Fixes: 7fc45dbc93 ("staging: erofs: introduce generic decompression backend")
[ Gao Xiang: v5.3+, I will manually backport this to stable later. ]
Link: https://lore.kernel.org/r/20200226081008.86348-3-gaoxiang25@huawei.com
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
2020-03-03 23:40:52 +08:00
..
Kconfig erofs: support superblock checksum 2019-11-24 11:02:41 +08:00
Makefile
compress.h
data.c erofs: fix erofs_get_meta_page locking due to a cleanup 2019-10-01 04:54:33 +08:00
decompressor.c erofs: handle corrupted images whose decompressed size less than it'd be 2020-03-03 23:40:52 +08:00
dir.c erofs: rename errln/infoln/debugln to erofs_{err, info, dbg} 2019-09-05 20:10:09 +02:00
erofs_fs.h erofs: support superblock checksum 2019-11-24 11:02:41 +08:00
inode.c erofs: always use iget5_locked 2019-09-05 20:10:09 +02:00
internal.h erofs: convert workstn to XArray 2020-03-03 23:27:25 +08:00
namei.c erofs: rename errln/infoln/debugln to erofs_{err, info, dbg} 2019-09-05 20:10:09 +02:00
super.c erofs: convert workstn to XArray 2020-03-03 23:27:25 +08:00
tagptr.h
utils.c erofs: correct the remaining shrink objects 2020-03-03 23:39:29 +08:00
xattr.c erofs: zero out when listxattr is called with no xattr 2019-12-04 21:15:04 +08:00
xattr.h erofs: correct indentation of an assigned structure inside a function 2020-01-07 10:08:27 +08:00
zdata.c erofs: convert workstn to XArray 2020-03-03 23:27:25 +08:00
zdata.h erofs: clean up decompress queue stuffs 2019-11-24 11:02:41 +08:00
zmap.c erofs: drop all vle annotations for runtime names 2019-11-24 11:02:41 +08:00
zpvec.h erofs: remove all likely/unlikely annotations 2019-08-30 09:02:02 +02:00