summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog5
-rw-r--r--src/unstrip.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 58fc5b85..90c78cb5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-04 Roland McGrath <[email protected]>
+
+ * unstrip.c (copy_elided_sections): Bail if stripped file has more
+ sections than unstripped file, rather than getting confused later.
+
2010-06-01 Roland McGrath <[email protected]>
* readelf.c (dwarf_form_string): Handle DWARF 4 forms.
diff --git a/src/unstrip.c b/src/unstrip.c
index 0984e6bc..755c42a3 100644
--- a/src/unstrip.c
+++ b/src/unstrip.c
@@ -1234,6 +1234,10 @@ copy_elided_sections (Elf *unstripped, Elf *stripped,
ELF_CHECK (elf_getshdrnum (stripped, &stripped_shnum) == 0,
_("cannot get section count: %s"));
+ if (unlikely (stripped_shnum > unstripped_shnum))
+ error (EXIT_FAILURE, 0, _("\
+more sections in stripped file than debug file -- arguments reversed?"));
+
/* Cache the stripped file's section details. */
struct section sections[stripped_shnum - 1];
Elf_Scn *scn = NULL;