readelf: avoid a possible divide by zero

Alan Modra amodra@gmail.com
Sun Dec 19 11:48:21 GMT 2021


	* readelf.c (process_section_headers): Check SHT_RELR entsize.

diff --git a/binutils/readelf.c b/binutils/readelf.c
index 2225b7d9046..990b7597dd3 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -7093,6 +7093,10 @@ process_section_headers (Filedata * filedata)
 	    warn (_("Section '%s': zero-sized relocation section\n"), name);
 	  break;
 
+	case SHT_RELR:
+	  CHECK_ENTSIZE (section, i, Relr);
+	  break;
+
 	case SHT_NOTE:
 	case SHT_PROGBITS:
 	  /* Having a zero sized section is not illegal according to the

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list