Skip to content

Commit 19b8fdb

Browse files
anjiahao1xiaoxiang781216
authored andcommitted
modlib:allow 64bit elf load
Signed-off-by: anjiahao <[email protected]>
1 parent 5e002d9 commit 19b8fdb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

libs/libc/modlib/modlib_bind.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ static int modlib_relocate(FAR struct module_s *modp,
333333

334334
/* Calculate the relocation address. */
335335

336-
if (rel->r_offset + sizeof(uint32_t) > dstsec->sh_size)
336+
if (rel->r_offset < 0 ||
337+
rel->r_offset > dstsec->sh_size)
337338
{
338339
berr("ERROR: Section %d reloc %d: "
339340
"Relocation address out of range, "
@@ -528,7 +529,8 @@ static int modlib_relocateadd(FAR struct module_s *modp,
528529

529530
/* Calculate the relocation address. */
530531

531-
if (rela->r_offset + sizeof(uint32_t) > dstsec->sh_size)
532+
if (rela->r_offset < 0 ||
533+
rela->r_offset > dstsec->sh_size)
532534
{
533535
berr("ERROR: Section %d reloc %d: "
534536
"Relocation address out of range, "

0 commit comments

Comments
 (0)