5 Commits

Author SHA1 Message Date
Pedro Falcato
583b54f824
Ext4Pkg: Skip zero-sized extents
Zero-sized extents should not be cached nor considered valid, as they
have no meaning. As such, reject them outright when caching extents.
This makes it so callers do not need to check for ee_len = 0 before
using the result, which, if not done, can result in possible infinite
loops.

Cc: Marvin Häuser <mhaeuser@posteo.de>
Fixes: d9ceedca6c8f ("Ext4Pkg: Add Ext4Dxe driver.")
Reported-by: Savva Mitrofanov <savvamtr@gmail.com>
Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
2023-07-03 13:54:43 +06:00
Savva Mitrofanov
d56c3a5610
Ext4Pkg: Correct MSVC compilation
MaxExtentsPerNode should be same type as eh_max uint16, because maximum
count of extent header entries is 65535

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2023-05-12 19:46:53 +03:00
Pedro Falcato
174fc2fbb9
Ext4Pkg: Improve extent node validation on the number of entries
Improve the extent tree node validation by validating the number of
entries the node advertises against the theoretical max (derived from
the size of on-disk structs and the block size (or i_data, if inline
extents).

Previously, we did not validate the number of entries. This could be
exploited for out-of-bounds reads and crashes.

Cc: Marvin Häuser <mhaeuser@posteo.de>
Fixes: d9ceedca6c8f ("Ext4Pkg: Add Ext4Dxe driver.")
Reported-by: Savva Mitrofanov <savvamtr@gmail.com>
Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com>
Reviewed-by: Marvin Häuser <mhaeuser@posteo.de>
2023-05-12 15:38:03 +03:00
Mikhail Krichanov
05702eddbd Ext4Pkg: Various improvements based on Sydr fuzzing results.
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2023-04-28 16:55:39 +03:00
Savva Mitrofanov
584fcbf4dd Ext4Pkg: Add EDK II Ext4 package
Adds a Pedro Falcato's UEFI EXT4 filesystem driver that implements the EFI_FILE_PROTOCOL and EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2023-04-28 16:55:39 +03:00