diff options
| author | Roland McGrath <[email protected]> | 2010-06-04 02:26:30 -0700 |
|---|---|---|
| committer | Roland McGrath <[email protected]> | 2010-06-14 12:52:09 -0700 |
| commit | 3b1b651d89d14b948a7e2436efdbe89d9bf691c0 (patch) | |
| tree | b4d719614a723049574e59cbf8dedd213247ed10 /src | |
| parent | 827d4d176b989c5d765c7f349edff6f994f8ea78 (diff) | |
unstrip: Bail early on bogus invocation with reversed arguments.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/unstrip.c | 4 |
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; |
