Whamcloud - gitweb
libext2fs: always refuse to open a file system with a zero s_desc_size maint
authorTheodore Ts'o <tytso@mit.edu>
Wed, 3 Apr 2024 21:30:37 +0000 (17:30 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 4 Apr 2024 02:49:13 +0000 (22:49 -0400)
commitef4e0825eee3d720a2df762249f0e80bb5f3ef3b
tree8ef6ecff253bb71271855a3d51100f427e7ba406
parent72e30620b1ebd4742a8cda6cd4220a5423ca3180
libext2fs: always refuse to open a file system with a zero s_desc_size

Commit 42c11edd0863 ("ext2fs_open[2](), return an error if s_desc_size
is too large") added a check for an insanely large s_desc_size to
prevent some failures triggered by fuzz testing.  However, it would
allow e2fsck to fall back to recover the file system by using the
backup superblocks by having e2fsck pass the flag
EXT2_FLAG_IGNORE_SB_ERRORS.  But by allowing an s_desc_Size of zero,
it's possible that e2fsck will die with a division of zero error.
With this fix, e2fsck will now print an error message and exit
instead.

https://github.com/tytso/e2fsprogs/issues/183

Fixes: 42c11edd0863 ("ext2fs_open[2](), return an error if s_desc_size is too large")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/openfs.c
tests/f_desc_size_zero/expect.1 [new file with mode: 0644]
tests/f_desc_size_zero/image.gz [new file with mode: 0644]
tests/f_desc_size_zero/name [new file with mode: 0644]
tests/f_desc_size_zero/script [new file with mode: 0644]