Blame SOURCES/0010-shim-Extend-invalid-reloc-size-warning-message.patch

d84fc6
From 956717e2b375d7c7f0faafec8f12a7692708eb9a Mon Sep 17 00:00:00 2001
d84fc6
From: Paul Menzel <pmenzel@molgen.mpg.de>
d84fc6
Date: Wed, 23 May 2018 12:32:37 +0200
d84fc6
Subject: [PATCH 10/62] shim: Extend invalid reloc size warning message
d84fc6
d84fc6
Knowing the value of the reloc directory size is helpful for debugging,
d84fc6
cf. issue #131 [1],
d84fc6
d84fc6
[1]: https://github.com/rhboot/shim/issues/131
d84fc6
d84fc6
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
d84fc6
Upstream-commit-id: dd3230d07f3
d84fc6
---
d84fc6
 shim.c | 10 ++++++++--
d84fc6
 1 file changed, 8 insertions(+), 2 deletions(-)
d84fc6
d84fc6
diff --git a/shim.c b/shim.c
d84fc6
index ff0817009cd..05fc65005d1 100644
d84fc6
--- a/shim.c
d84fc6
+++ b/shim.c
d84fc6
@@ -280,8 +280,14 @@ static EFI_STATUS relocate_coff (PE_COFF_LOADER_IMAGE_CONTEXT *context,
d84fc6
 	while (RelocBase < RelocBaseEnd) {
d84fc6
 		Reloc = (UINT16 *) ((char *) RelocBase + sizeof (EFI_IMAGE_BASE_RELOCATION));
d84fc6
 
d84fc6
-		if ((RelocBase->SizeOfBlock == 0) || (RelocBase->SizeOfBlock > context->RelocDir->Size)) {
d84fc6
-			perror(L"Reloc %d block size %d is invalid\n", n, RelocBase->SizeOfBlock);
d84fc6
+		if (RelocBase->SizeOfBlock == 0) {
d84fc6
+			perror(L"Reloc %d block size 0 is invalid\n", n);
d84fc6
+			return EFI_UNSUPPORTED;
d84fc6
+		} else if (RelocBase->SizeOfBlock > context->RelocDir->Size) {
d84fc6
+			perror(L"Reloc %d block size %d greater than reloc dir"
d84fc6
+					"size %d, which is invalid\n", n,
d84fc6
+					RelocBase->SizeOfBlock,
d84fc6
+					context->RelocDir->Size);
d84fc6
 			return EFI_UNSUPPORTED;
d84fc6
 		}
d84fc6
 
d84fc6
-- 
d84fc6
2.26.2
d84fc6