Whamcloud - gitweb
libext2fs: return an error when byte swapping a corrupted dirblock block
authorTheodore Ts'o <tytso@mit.edu>
Sun, 14 Aug 2022 03:32:42 +0000 (23:32 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 14 Aug 2022 03:32:42 +0000 (23:32 -0400)
commitb84eee32d54b20679b27cdff231cd72619e4cc44
tree9ea1ba1ee3198d824acd9f17be62bf10d49c2774
parent7294686e58990a7d510bbe7d9598ca0910d0ad4b
libext2fs: return an error when byte swapping a corrupted dirblock block

Except for e2fsck (where we want to expose the corrupted directory
entries to e2fsck mostly so that the e2fsck output stays the same on
big-endian machines compared to little-endian machines, so we don't
break our regression tests), if the directory block is corrupted, and
ext2fs_dirent_swab_in[2](), trips across this, return an error.  This
will make sure that naive users of libextfs will not try to handle a
corrupted directory block.  This prevents potential buffer overruns in
the byte swapping code paths.

This commit does not cause any functional change on little-endian
systems.

Addresses-Coverity-Bug: 1433408
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/pass2.c
lib/ext2fs/ext2fs.h
lib/ext2fs/swapfs.c