Преглед изворни кода

apt-inst: Do not try to create a substring of an empty string in error reporting

One of our compressors (the empty one) has an empty extension. Calling substr
on it fails.
Julian Andres Klode пре 12 година
родитељ
комит
b68ce88357
1 измењених фајлова са 4 додато и 2 уклоњено
  1. 4 2
      apt-inst/deb/debfile.cc

+ 4 - 2
apt-inst/deb/debfile.cc

@@ -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());
    }