[binutils-gdb] PR 33697, fuzzer segfault
Alan Modra
amodra@sourceware.org
Mon Dec 8 09:25:04 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=66a3492ce68e1ae45b2489bd9a815c39ea5d7f66
commit 66a3492ce68e1ae45b2489bd9a815c39ea5d7f66
Author: Alan Modra <amodra@gmail.com>
Date: Mon Dec 8 15:58:33 2025 +1030
PR 33697, fuzzer segfault
PR 33697
* readelf.c (process_relocs): Don't segfault on no sections.
Diff:
---
binutils/readelf.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 1bd9afa1ec1..b3f59aa2128 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -10048,13 +10048,11 @@ process_relocs (Filedata * filedata)
size_t i;
bool found = false;
- for (i = 0, section = filedata->section_headers;
- i < filedata->file_header.e_shnum;
- i++, section++)
- {
+ section = filedata->section_headers;
+ if (section != NULL)
+ for (i = 0; i < filedata->file_header.e_shnum; i++, section++)
if (display_relocations (section, filedata, do_reloc))
found = true;
- }
if (do_reloc && ! found)
{
More information about the Binutils-cvs
mailing list