Skip to content

Commit

Permalink
modlib:allow 64bit elf load
Browse files Browse the repository at this point in the history
Signed-off-by: anjiahao <[email protected]>
  • Loading branch information
anjiahao1 committed Oct 14, 2024
1 parent f417d14 commit ec54821
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libs/libc/modlib/modlib_bind.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, "
Expand Down Expand Up @@ -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, "
Expand Down

0 comments on commit ec54821

Please sign in to comment.