loader/i386/bsd: Use safe math to avoid underflow
authorAlec Brown <alec.r.brown@oracle.com>
Wed, 5 Feb 2025 22:04:08 +0000 (22:04 +0000)
committerAurelien Jarno <aurel32@debian.org>
Thu, 30 Apr 2026 19:02:01 +0000 (21:02 +0200)
commit8cb0c5aa42d7d2c52408232385334a3c193dec1a
treeb23b76c435dab4f97e83bddcecbc75804212788a
parent2a2ea8aa3c4e59b15fab0b33d96964dadd63c7e8
loader/i386/bsd: Use safe math to avoid underflow

The operation kern_end - kern_start may underflow when we input it into
grub_relocator_alloc_chunk_addr() call. To avoid this we can use safe
math for this subtraction.

Fixes: CID 73845
Signed-off-by: Alec Brown <alec.r.brown@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Gbp-Pq: Topic cve-2025-jan
Gbp-Pq: Name loader-i386-bsd-Use-safe-math-to-avoid-underflow.patch
grub-core/loader/i386/bsd.c