Browse Source

Dpkg::Shlibs::Objdump:Object: Warn for unknown exec formats in analyze()

Emit an explicit warning whenever we cannot detect the format for
an executable object, instead of delegating this to the subsequent
objdump, and letting it die, which ca be canfusing and is not
future-proof.

Closes: #854536
Guillem Jover 7 years ago
parent
commit
0fad19f2a3
2 changed files with 7 additions and 0 deletions
  1. 2 0
      debian/changelog
  2. 5 0
      scripts/Dpkg/Shlibs/Objdump.pm

+ 2 - 0
debian/changelog

@@ -8,6 +8,8 @@ dpkg (1.18.23) UNRELEASED; urgency=medium
       the code has been fixed in NetBSD as that situation could not happen.
     - Fix read() error handling in Dpkg::Shlibs::Objdump::get_format() to
       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.
   * Documentation:
     - Clarify the requirements for deb-conffile(5) pathnames. Closes: #854417
       Proposed by Dieter Adriaenssens <dieter.adriaenssens@gmail.com>.

+ 5 - 0
scripts/Dpkg/Shlibs/Objdump.pm

@@ -293,6 +293,11 @@ sub analyze {
 
     $self->{exec_abi} = Dpkg::Shlibs::Objdump::get_format($file);
 
+    if (not defined $self->{exec_abi}) {
+        warning(g_("unknown executable format in file '%s'"), $file);
+        return;
+    }
+
     local $ENV{LC_ALL} = 'C';
     open(my $objdump, '-|', $OBJDUMP, '-w', '-f', '-p', '-T', '-R', $file)
         or syserr(g_('cannot fork for %s'), $OBJDUMP);