This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 3/4] readelf: Fix off by one error whilst checking reloc location against section size.
- From: Christian Eggers <ceggers at gmx dot de>
- To: binutils at sourceware dot org
- Cc: Christian Eggers <ceggers at gmx dot de>
- Date: Sun, 3 Nov 2019 08:57:42 +0100
- Subject: [PATCH 3/4] readelf: Fix off by one error whilst checking reloc location against section size.
- References: <20191103075743.25467-1-ceggers@gmx.de>
* readelf.c (IN_RANGE): Fix off by one error
whilst checking reloc location against section size.
Signed-off-by: Christian Eggers <ceggers@gmx.de>
---
binutils/ChangeLog | 2 ++
binutils/readelf.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index f25e6365ba..0e3e3fc535 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -3,6 +3,8 @@
* readelf.c (IN_RANGE): Rename parameter OFF to SIZE.
* readelf.c (IN_RANGE): Catch potential integer overflow
whilst checking reloc location against section size.
+ * readelf.c (IN_RANGE): Fix off by one error
+ whilst checking reloc location against section size.
2019-10-20 Palmer Dabbelt <palmer@sifive.com>
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 1854e866d7..f426cbb2be 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -12310,7 +12310,7 @@ process_syminfo (Filedata * filedata ATTRIBUTE_UNUSED)
}
#define IN_RANGE(START,END,ADDR,SIZE) \
- (((ADDR) >= (START)) && ((ADDR) < (END)) && ((ADDR) + (SIZE) < (END)))
+ (((ADDR) >= (START)) && ((ADDR) < (END)) && ((ADDR) + (SIZE) <= (END)))
/* Check to see if the given reloc needs to be handled in a target specific
manner. If so then process the reloc and return TRUE otherwise return
--
2.16.4