Skip to content

FIX: NULL pointer dereference in ext4_dir_en_get_name_len#1

Merged
sigdevel merged 2 commits intomasterfrom
dev
Mar 4, 2026
Merged

FIX: NULL pointer dereference in ext4_dir_en_get_name_len#1
sigdevel merged 2 commits intomasterfrom
dev

Conversation

@Daniil-KOT
Copy link
Copy Markdown
Collaborator

When traversing an inode’s extent tree, ext4_ext_binsearch_idx() assumes that the extent header has already been validated. However, it doesn't check header's "eh_entries" field to be non‑zero when header's depth (eh_depth) is greater than zero. If "eh_entries" value is zero, but eh_depth indicates an internal node, the macros
EXT_FIRST_INDEX/EXT_LAST_INDEX return invalid pointers and the binary search reads past the allocated buffer. This leads to segv on corrupted or fuzzed ext4-images.

To fix the issue check if valid entries count is not greater than max entries count.

Daniil Dulov added 2 commits March 4, 2026 18:05
When traversing an inode’s extent tree, ext4_ext_binsearch_idx() assumes
that the extent header has already been validated. However, it doesn't
check header's "eh_entries" field to be non‑zero when header's depth
(eh_depth) is greater than zero. If "eh_entries" value is zero, but
eh_depth indicates an internal node, the macros
EXT_FIRST_INDEX/EXT_LAST_INDEX return invalid pointers and the binary
search reads past the allocated buffer. This leads to segv on corrupted
or fuzzed ext4-images.

To fix the issue check if valid entries count is not greater than
max entries count.
When processing a crafted ex4-image containing malformed directory entries,
it is possible for dirctory entry (de) pointer to become NULL leading to a
NULL pointer dereference while reading the "name_len" field of a directory
entry.

To fix the issue check if de is not NULL before dereferencing it.
@sigdevel
Copy link
Copy Markdown
Collaborator

sigdevel commented Mar 4, 2026

Approved

@sigdevel sigdevel merged commit d68644e into master Mar 4, 2026
@ald-rd ald-rd changed the title FIX: Out-of-Bounds Read in ext4_ext_binsearch_idx() FIX: NULL pointer dereference in ext4_dir_en_get_name_len Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants