mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-23 15:49:23 +00:00
mmap/mmap: Fix integer overflow in binary search
The integer overflow triggered for simple masks in the "badram" command, such as "badram 0x0000000012340000,0xfffffffffffffff8". This resulted in an infinite loop, locking up the machine. Signed-off-by: Wanda Phinode <wanda@phinode.net> Reviewed-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
1 parent
eaa3b8f0f9
commit
170221b355
1 file changed
+1
-1
@@ -409,7 +409,7 @@ badram_iter (grub_uint64_t addr, grub_uint64_t size,
|
||||
*/
|
||||
while (high - low > 1)
|
||||
{
|
||||
cur = (low + high) / 2;
|
||||
cur = low + (high - low) / 2;
|
||||
if (fill_mask (entry, cur) >= addr)
|
||||
high = cur;
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user