mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
Kernel: Reject loading ELF files with no loadable segments
If there's no loadable segments then there can't be any code to execute either. This resolves a crash these kinds of ELF files would cause from the directly following VERIFY statement.
This commit is contained in:
parent
2a6b492c7f
commit
1bea780a7f
1 changed files with 4 additions and 0 deletions
|
@ -201,6 +201,10 @@ static ErrorOr<RequiredLoadRange> get_required_load_range(OpenFileDescription& p
|
|||
range.end = region_end;
|
||||
});
|
||||
|
||||
// If there's nothing to load, there's nothing to execute
|
||||
if (range.start == range.end)
|
||||
return EINVAL;
|
||||
|
||||
VERIFY(range.end > range.start);
|
||||
return range;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue