Ext4Pkg: Code correctness and security improvements
This changes tends to improve security of code sections by fixing integer overflows, missing alignment checks, unsafe casts, also simplified some routines, fixed compiler warnings and corrected some code mistakes. - Set HoleLen to UINT64 to prevent truncation in Ext4Read function - Replace EXT4_BLOCK_NR with 32-bit EXT2_BLOCK_NR in BlockMap, because by specification files using block maps must be placed within the first 2^32 blocks of a filesystem - Replace UNREACHABLE with ASSERT (FALSE) in case of new checksum algorithms, due to it is an invariant violation rather than unreachable path - Solve compiler warnings. Initialize all fields in gExt4BindingProtocol Fix comparison of integer expressions of different signedness - Field name_len has type CHAR8, while filename limit is 255 (EXT4_NAME_MAX), so because structure EXT4_DIR_ENTRY would be unchangeable in future, we could drop this check without any assertions - Simplify Ext4RemoveDentry logic by using IsNodeInList - Fix possible int overflow in Ext4ExtentsMapKeyCompare - Return bad block type in Ext4GetBlockpath - Adds 4-byte aligned check for superblock group descriptor size field Cc: Marvin Häuser <mhaeuser@posteo.de> Cc: Pedro Falcato <pedro.falcato@gmail.com> Cc: Vitaly Cheptsov <vit9696@protonmail.com> Signed-off-by:Savva Mitrofanov <savvamtr@gmail.com> Reviewed-by:
Marvin Häuser <mhaeuser@posteo.de> Reviewed-by:
Pedro Falcato <pedro.falcato@gmail.com>
Loading
Please register or sign in to comment