]> git.saurik.com Git - apt.git/commitdiff
apt-inst: Do not try to create a substring of an empty string in error reporting
authorJulian Andres Klode <jak@debian.org>
Mon, 17 Mar 2014 12:43:12 +0000 (13:43 +0100)
committerJulian Andres Klode <jak@debian.org>
Mon, 17 Mar 2014 12:45:52 +0000 (13:45 +0100)
One of our compressors (the empty one) has an empty extension. Calling substr
on it fails.

apt-inst/deb/debfile.cc

index 3803329fa37eb3f4f135f0011ed33fd2a32f6be7..a63cb6716264a2131a20d18953b3796d3889ba9e 100644 (file)
@@ -124,8 +124,10 @@ bool debDebFile::ExtractTarMember(pkgDirStream &Stream,const char *Name)
    {
       std::string ext = std::string(Name) + ".{";
       for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin();
-          c != compressor.end(); ++c)
-        ext.append(c->Extension.substr(1));
+          c != compressor.end(); ++c) {
+        if (!c->Extension.empty())
+           ext.append(c->Extension.substr(1));
+      }
       ext.append("}");
       return _error->Error(_("Internal error, could not locate member %s"), ext.c_str());
    }