readelf: avoid a possible divide by zero
authorAlan Modra <amodra@gmail.com>
Sun, 19 Dec 2021 01:48:50 +0000 (12:18 +1030)
committerAlan Modra <amodra@gmail.com>
Sun, 19 Dec 2021 01:54:16 +0000 (12:24 +1030)
* readelf.c (process_section_headers): Check SHT_RELR entsize.

binutils/readelf.c

index 2225b7d9046691e42e6c53305bf0260c36b8fb9e..990b7597dd370af639b3fb89fac2b22e901f9a0f 100644 (file)
@@ -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