This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cygwin setup 2.510.2.1 does not work because of an invaliditerator.


Hi.

# Excuse me my poor English.

I found the cause of crash on setup.exe 2.510.2.1 built by GCC 3.4.4.
Please try an attached patch.

Calling erase() in packagemata::ScanDownloadedFiles() invalidates
iterator i.
Therefore, ++i after erase() means an operation to a invalid
iterator. I guess it is the cause of a crash of setup.exe.

------------------------------------------------------------
I tested in the following configuration:
------------------------------------------------------------
bash-3.00$ uname -svr
CYGWIN_NT-5.0 1.5.18(0.132/4/2) 2005-07-02 20:30
bash-3.00$ cygcheck -c gcc gcc-mingw-g++ make mingw-zlib mingw-bzip2
Cygwin Package Information
Package              Version        Status
gcc                  3.4.4-1        OK
gcc-mingw-g++        20050522-1     OK
make                 3.80-1         OK
mingw-bzip2          1.0.3-1        OK
mingw-zlib           1.2.2-2        OK
------------------------------------------------------------

Regards,
  Masayuki FUJII
Index: package_meta.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/package_meta.cc,v
retrieving revision 2.49
diff -u -r2.49 package_meta.cc
--- package_meta.cc	1 Sep 2005 16:39:27 -0000	2.49
+++ package_meta.cc	10 Sep 2005 01:37:32 -0000
@@ -616,8 +616,8 @@
        n != db.packages.end (); ++n)
     {
       packagemeta & pkg = **n;
-      for (set<packageversion>::iterator i = pkg.versions.begin (); 
-    i != pkg.versions.end (); ++i)
+      set<packageversion>::iterator i = pkg.versions.begin ();
+      while (i != pkg.versions.end ())
   {
        /* scan doesn't alter operator == for packageversions */
       const_cast<packageversion &>(*i).scan();
@@ -636,9 +636,11 @@
       pkg.curr = packageversion();
          if (pkg.exp == *i)
        pkg.exp = packageversion();
-          pkg.versions.erase(i);
+          pkg.versions.erase(i++);
          /* For now, leave the source version alone */
         }
+    else
+      ++i;
   }
     }
   /* Don't explicity iterate through sources - any sources that aren't 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]