binutils/binutils-2.19-readelf-CAN-2005-1704.patch

23 lines
920 B
Diff
Raw Permalink Normal View History

--- binutils-2.16.1/binutils/readelf.c.orig 2005-06-16 12:25:11.000000000 +0200
+++ binutils-2.16.1/binutils/readelf.c 2005-06-16 12:33:37.000000000 +0200
@@ -4123,6 +4123,19 @@ process_section_groups (FILE *file)
entry = byte_get (indices, 4);
indices += 4;
+ if (entry >= elf_header.e_shnum)
+ {
+ error (_("section [%5u] in group section [%5u] > maximum section [%5u]\n"),
+ entry, i, elf_header.e_shnum - 1);
+ continue;
+ }
+ else if (entry >= SHN_LORESERVE && entry <= SHN_HIRESERVE)
+ {
+ error (_("invalid section [%5u] in group section [%5u]\n"),
+ entry, i);
+ continue;
+ }
+
if (do_section_groups)
{
printf ("\n%s group section [%5u] `%s' [%s] contains %u sections:\n",