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