mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-16 01:05:15 +08:00
is_pte_valid() accepted a GPT entry as long as both LBAs were inside the disk, so a crafted image could set ending_lba < starting_lba. The size computed in efi_partition() then underflowed to a huge value and was registered as the logical partition size. Reject entries whose end LBA is below the start LBA, and compute the partition start/size only after the entry passed validation. This avoids evaluating the underflow at all and reuses the validated start value for the size calculation. Fixes RT-Thread/rt-thread#11271. Co-authored-by: DeepSeek 4.1 Flash <noreply@deepseek.com>