mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 03:05:40 +08:00
modlib_bind.c: Restore "Relocation address out of range" checks
Restore the checks which got completely broken by the following change.
```
commit 15142a8b10
Author: anjiahao <anjiahao@xiaomi.com>
Date: Fri Apr 1 16:20:03 2022 +0800
modlib/modlib_bind:fix unsigned_compare with zero
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
```
This commit is contained in:
committed by
Petro Karashchenko
parent
bf48c6d4a8
commit
75b1358d8e
@@ -297,8 +297,7 @@ static int modlib_relocate(FAR struct module_s *modp,
|
|||||||
|
|
||||||
/* Calculate the relocation address. */
|
/* Calculate the relocation address. */
|
||||||
|
|
||||||
if (rel->r_offset ||
|
if (rel->r_offset + sizeof(uint32_t) > dstsec->sh_size)
|
||||||
rel->r_offset + sizeof(uint32_t) > dstsec->sh_size)
|
|
||||||
{
|
{
|
||||||
berr("ERROR: Section %d reloc %d: "
|
berr("ERROR: Section %d reloc %d: "
|
||||||
"Relocation address out of range, "
|
"Relocation address out of range, "
|
||||||
@@ -485,8 +484,7 @@ static int modlib_relocateadd(FAR struct module_s *modp,
|
|||||||
|
|
||||||
/* Calculate the relocation address. */
|
/* Calculate the relocation address. */
|
||||||
|
|
||||||
if (rela->r_offset ||
|
if (rela->r_offset + sizeof(uint32_t) > dstsec->sh_size)
|
||||||
rela->r_offset + sizeof(uint32_t) > dstsec->sh_size)
|
|
||||||
{
|
{
|
||||||
berr("ERROR: Section %d reloc %d: "
|
berr("ERROR: Section %d reloc %d: "
|
||||||
"Relocation address out of range, "
|
"Relocation address out of range, "
|
||||||
|
|||||||
Reference in New Issue
Block a user