summaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-12-19 12:18:50 +1030
committerAlan Modra <amodra@gmail.com>2021-12-19 12:24:16 +1030
commit682351b932ba546b4451560917e819681c808f52 (patch)
tree89ade16726266feb0ec390a213f35b025dc1fc53 /binutils/readelf.c
parent6b526f64aae3a519e3c5e27543d3bf5b2cce015f (diff)
downloadbinutils-gdb-682351b932ba546b4451560917e819681c808f52.tar.gz
readelf: avoid a possible divide by zero
* readelf.c (process_section_headers): Check SHT_RELR entsize.
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c4
1 files changed, 4 insertions, 0 deletions
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