mirror of
https://gitee.com/openharmony/third_party_f2fs-tools
synced 2024-11-26 19:51:32 +00:00
fsck.f2fS: is_valid_summary(): check whether offset is out of bounds
commit 63d5004573
category: bugfix
issue: #I6VAS0
CVE: NA
Signed-off-by: DongSenhao <dongsenhao2@huawei.com>
---------------------------------------
This adds a check to the is_valid_summary function to prevent a segfault
if the calculated offset is out of bounds. Such an offset can for example
occur as the result of corruption of the underlying hardware.
I encountered this segfault on my own phone's sd card, so this is not
just a theoretical concern.
Signed-off-by: Arpad Müller <arpad.mueller@uni-bonn.de>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: dongsenhao <dongsenhao2@huawei.com>
This commit is contained in:
parent
5ff868458b
commit
cc815563fc
@ -250,8 +250,12 @@ static int is_valid_summary(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
|
||||
if (node_blk->footer.nid == node_blk->footer.ino) {
|
||||
int ofs = get_extra_isize(node_blk);
|
||||
|
||||
if (ofs + ofs_in_node >= DEF_ADDRS_PER_INODE)
|
||||
goto out;
|
||||
target_blk_addr = node_blk->i.i_addr[ofs + ofs_in_node];
|
||||
} else {
|
||||
if (ofs_in_node >= DEF_ADDRS_PER_BLOCK)
|
||||
goto out;
|
||||
target_blk_addr = node_blk->dn.addr[ofs_in_node];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user