The elf ndx should not be bigger than, or equal to shnum. This really
should never trigger unless elf_ndx and/or elf_getshdrnum is buggy.
* src/elfcompress.c (process_file): Check ndx >= shnum.
Signed-off-by: Mark Wielaard <[email protected]>
---
src/elfcompress.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/elfcompress.c b/src/elfcompress.c
index 630eb54da1c0..25ebd1be5c62 100644
--- a/src/elfcompress.c
+++ b/src/elfcompress.c
@@ -483,7 +483,7 @@ process_file (const char *fname)
while ((scn = elf_nextscn (elf, scn)) != NULL)
{
size_t ndx = elf_ndxscn (scn);
- if (ndx > shnum)
+ if (ndx >= shnum)
{
error (0, 0, "Unexpected section number %zd, expected only %zd",
ndx, shnum);
--
2.53.0