Ver código fonte

handle moved mmap after UniqFindTagWrite call

A call to UniqFindTagWrite can trigger the need for a bigger mmap, which
is usually done by moving it, but with this move all pointers into it
become invalid (and have to be remapped). The compiler calculates the
pointer before the execution of the call though, so it tries to store
the returned value at the old location, resulting in a segfault.
We solve this by use of a temprorary variable as we did in the other
instances of this problem before.

Closes: #753941
David Kalnischkies 12 anos atrás
pai
commit
4ea471ecb0
1 arquivos alterados com 6 adições e 2 exclusões
  1. 6 2
      apt-pkg/deb/deblistparser.cc

+ 6 - 2
apt-pkg/deb/deblistparser.cc

@@ -145,7 +145,8 @@ unsigned char debListParser::ParseMultiArch(bool const showErrors)	/*{{{*/
 bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
 bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
 {
 {
    // Parse the section
    // Parse the section
-   Ver->Section = UniqFindTagWrite("Section");
+   unsigned long const idxSection = UniqFindTagWrite("Section");
+   Ver->Section = idxSection;
    Ver->MultiArch = ParseMultiArch(true);
    Ver->MultiArch = ParseMultiArch(true);
    // Archive Size
    // Archive Size
    Ver->Size = Section.FindULL("Size");
    Ver->Size = Section.FindULL("Size");
@@ -260,7 +261,10 @@ bool debListParser::UsePackage(pkgCache::PkgIterator &Pkg,
 			       pkgCache::VerIterator &Ver)
 			       pkgCache::VerIterator &Ver)
 {
 {
    if (Pkg->Section == 0)
    if (Pkg->Section == 0)
-      Pkg->Section = UniqFindTagWrite("Section");
+   {
+      unsigned long const idxSection = UniqFindTagWrite("Section");
+      Pkg->Section = idxSection;
+   }
 
 
    string const static myArch = _config->Find("APT::Architecture");
    string const static myArch = _config->Find("APT::Architecture");
    // Possible values are: "all", "native", "installed" and "none"
    // Possible values are: "all", "native", "installed" and "none"