Browse Source

Dpkg::Shlibs::Objdump: Do not parse bogus ELF binaries in get_format()

If the ELF class or endianness are unknown or bogus, ignore the file.

Reported-by: Niels Thykier <niels@thykier.net>
Guillem Jover 7 years ago
parent
commit
952326db37
2 changed files with 4 additions and 2 deletions
  1. 2 0
      debian/changelog
  2. 2 2
      scripts/Dpkg/Shlibs/Objdump.pm

+ 2 - 0
debian/changelog

@@ -10,6 +10,8 @@ dpkg (1.18.23) UNRELEASED; urgency=medium
       gracefully ignore non-ELF files again. Closes: #854536
     - Emit an explicit warning from Dpkg::Shlibs::Objdump::Object::analyze()
       for unknown executable formats instead of relying on objdump doing so.
+    - Do not parse bogus ELF binaries in Dpkg::Shlibs::Objdump::get_format().
+      Reported by Niels Thykier <niels@thykier.net>.
   * Documentation:
     - Clarify the requirements for deb-conffile(5) pathnames. Closes: #854417
       Proposed by Dieter Adriaenssens <dieter.adriaenssens@gmail.com>.

+ 2 - 2
scripts/Dpkg/Shlibs/Objdump.pm

@@ -201,14 +201,14 @@ sub get_format {
         $elf_word = 'L';
     } elsif ($elf{bits} == ELF_BITS_64) {
         $elf_word = 'Q';
-    } elsif ($elf{bits} == ELF_BITS_NONE) {
+    } else {
         return;
     }
     if ($elf{endian} == ELF_ORDER_2LSB) {
         $elf_endian = '<';
     } elsif ($elf{endian} == ELF_ORDER_2MSB) {
         $elf_endian = '>';
-    } elsif ($elf{endian} == ELF_ORDER_NONE) {
+    } else {
         return;
     }