You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/10/14 19:20:12 UTC
(nuttx) 01/02: modlib:allow 64bit elf load
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 19b8fdbad635173e622bcf989448832016509d18
Author: anjiahao <an...@xiaomi.com>
AuthorDate: Sun Oct 13 17:24:17 2024 +0800
modlib:allow 64bit elf load
Signed-off-by: anjiahao <an...@xiaomi.com>
---
libs/libc/modlib/modlib_bind.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libs/libc/modlib/modlib_bind.c b/libs/libc/modlib/modlib_bind.c
index af1e09366a..5b8cce26c2 100644
--- a/libs/libc/modlib/modlib_bind.c
+++ b/libs/libc/modlib/modlib_bind.c
@@ -333,7 +333,8 @@ static int modlib_relocate(FAR struct module_s *modp,
/* Calculate the relocation address. */
- if (rel->r_offset + sizeof(uint32_t) > dstsec->sh_size)
+ if (rel->r_offset < 0 ||
+ rel->r_offset > dstsec->sh_size)
{
berr("ERROR: Section %d reloc %d: "
"Relocation address out of range, "
@@ -528,7 +529,8 @@ static int modlib_relocateadd(FAR struct module_s *modp,
/* Calculate the relocation address. */
- if (rela->r_offset + sizeof(uint32_t) > dstsec->sh_size)
+ if (rela->r_offset < 0 ||
+ rela->r_offset > dstsec->sh_size)
{
berr("ERROR: Section %d reloc %d: "
"Relocation address out of range, "