summaryrefslogtreecommitdiff
path: root/BaseTools/Source/C/GenFw/Elf64Convert.c
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Source/C/GenFw/Elf64Convert.c')
-rw-r--r--BaseTools/Source/C/GenFw/Elf64Convert.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c
index fb85b3821b..974f3ca53a 100644
--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -197,8 +197,11 @@ GetShdrByIndex (
UINT32 Num
)
{
- if (Num >= mEhdr->e_shnum)
- return NULL;
+ if (Num >= mEhdr->e_shnum) {
+ Error (NULL, 0, 3000, "Invalid", "GetShdrByIndex: Index %u is too high.", Num);
+ exit(EXIT_FAILURE);
+ }
+
return (Elf_Shdr*)((UINT8*)mShdrBase + Num * mEhdr->e_shentsize);
}