Blame SOURCES/0227-efi-chainloader-fix-wrong-sanity-check-in-relocate_c.patch

f725e3
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f725e3
From: Laszlo Ersek <lersek@redhat.com>
f725e3
Date: Mon, 21 Nov 2016 15:34:00 +0100
f725e3
Subject: [PATCH] efi/chainloader: fix wrong sanity check in relocate_coff()
f725e3
f725e3
In relocate_coff(), the relocation entries are parsed from the original
f725e3
image (not the section-wise copied image). The original image is
f725e3
pointed-to by the "orig" pointer. The current check
f725e3
f725e3
  (void *)reloc_end < data
f725e3
f725e3
compares the addresses of independent memory allocations. "data" is a typo
f725e3
here, it should be "orig".
f725e3
f725e3
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1347291
f725e3
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
f725e3
Tested-by: Bogdan Costescu <bcostescu@gmail.com>
f725e3
Tested-by: Juan Orti <j.orti.alcaine@gmail.com>
f725e3
---
f725e3
 grub-core/loader/efi/chainloader.c | 2 +-
f725e3
 1 file changed, 1 insertion(+), 1 deletion(-)
f725e3
f725e3
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
f725e3
index 3e89de9006c..ed8c364789a 100644
f725e3
--- a/grub-core/loader/efi/chainloader.c
f725e3
+++ b/grub-core/loader/efi/chainloader.c
f725e3
@@ -401,7 +401,7 @@ relocate_coff (pe_coff_loader_image_context_t *context,
f725e3
       reloc_end = (struct grub_pe32_fixup_block *)
f725e3
 	((char *)reloc_base + reloc_base->size);
f725e3
 
f725e3
-      if ((void *)reloc_end < data || (void *)reloc_end > image_end)
f725e3
+      if ((void *)reloc_end < orig || (void *)reloc_end > image_end)
f725e3
         {
f725e3
           grub_error (GRUB_ERR_BAD_ARGUMENT, "Reloc entry %d overflows binary",
f725e3
 		      n);