summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2025-06-02 01:35:16 +0200
committerMark Wielaard <[email protected]>2025-06-02 01:35:16 +0200
commit6bb3ff44a4029562f45ddac354c670aa51ae7b87 (patch)
tree5cc52eea040d6fe5c4a788cf6753e165951d1f77
parent11db83c3c0ab0d0325165f448ea4b6b254d7e2ea (diff)
unstrip: exit early if there are no sections in the stripped file
If there is only section zero that shouldn't count. Then we would still try to work on an empty set of sections and give an obscure error later. * src/unstrip.c (copy_elided_sections): Check stripped_shnum <= 1. Signed-off-by: Mark Wielaard <[email protected]>
-rw-r--r--src/unstrip.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/unstrip.c b/src/unstrip.c
index 0ae76f77..81c5496f 100644
--- a/src/unstrip.c
+++ b/src/unstrip.c
@@ -1447,7 +1447,7 @@ copy_elided_sections (Elf *unstripped, Elf *stripped,
error_exit (0, _("\
more sections in stripped file than debug file -- arguments reversed?"));
- if (unlikely (stripped_shnum == 0))
+ if (unlikely (stripped_shnum <= 1))
error_exit (0, _("no sections in stripped file"));
/* Used as sanity check for allocated section offset, if the section