Whamcloud - gitweb
LU-8465 ext2fs: fix to avoid invalid memory access 50/39850/9
authorWang Shilong <wshilong@ddn.com>
Fri, 19 Jun 2020 02:20:39 +0000 (10:20 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Sat, 26 Sep 2020 06:38:57 +0000 (06:38 +0000)
commitd8b23ec2a3a900ecf2040ea67a9b4b34d499c536
tree7960c9b60ba78e5d4e2bbf30dfd68d7d806d8805
parenta6a2410f4fa0b02f3fda8876d4b6037ddc6ef65c
LU-8465 ext2fs: fix to avoid invalid memory access

Dir block might be corrupted and cause the next dirent is out
of block size boundary, even though we have the check to avoid
problem, memory check tools like valgrind still complains it.

Patch try to fix the problem by checking if offset exceed max
offset firstly before getting the pointer.

Signed-off-by: Wang Shilong <wshilong@ddn.com>
Change-Id: I40c4587bb35b7f22d47f37b4ffa52ef822f11b41
Reviewed-on: https://review.whamcloud.com/39850
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lib/ext2fs/csum.c