poldek: poldek/pkg.c, poldek/pkgmark.c, poldek/pkgset-req.c - fixe...

mis mis at pld-linux.org
Mon Sep 11 23:47:50 CEST 2006


Author: mis                          Date: Mon Sep 11 21:47:50 2006 GMT
Module: poldek                        Tag: HEAD
---- Log message:
- fixed SIGSEV (devel-pl:89b6ba3a0609060202r6ac8f6bdh481adf5c3aadcdc at mail.gmail.com)

---- Files affected:
poldek/poldek:
   pkg.c (1.111 -> 1.112) , pkgmark.c (1.7 -> 1.8) , pkgset-req.c (1.45 -> 1.46) 

---- Diffs:

================================================================
Index: poldek/poldek/pkg.c
diff -u poldek/poldek/pkg.c:1.111 poldek/poldek/pkg.c:1.112
--- poldek/poldek/pkg.c:1.111	Sun Aug 20 23:13:19 2006
+++ poldek/poldek/pkg.c	Mon Sep 11 23:47:45 2006
@@ -1380,7 +1380,8 @@
              pkg->na ? pkg->na->_refcnt : -1,
              pkg->_refcnt, &pkg->_refcnt);
     }
-#endif    
+#endif
+    n_assert(pkg->_refcnt < INT16_MAX - 1);
     pkg->_refcnt++;
     return pkg;
 }

================================================================
Index: poldek/poldek/pkgmark.c
diff -u poldek/poldek/pkgmark.c:1.7 poldek/poldek/pkgmark.c:1.8
--- poldek/poldek/pkgmark.c:1.7	Sun Jun 12 22:17:13 2005
+++ poldek/poldek/pkgmark.c	Mon Sep 11 23:47:45 2006
@@ -145,6 +145,7 @@
     const char *id;
     
     id = package_id(idbuf, sizeof(idbuf), pmark, pkg);
+    n_assert(id);
 
     if ((pkg_mark = n_hash_get(pmark->ht, id)))
         return pkg_mark->flags & flag;

================================================================
Index: poldek/poldek/pkgset-req.c
diff -u poldek/poldek/pkgset-req.c:1.45 poldek/poldek/pkgset-req.c:1.46
--- poldek/poldek/pkgset-req.c:1.45	Sun Aug 20 23:13:19 2006
+++ poldek/poldek/pkgset-req.c	Mon Sep 11 23:47:45 2006
@@ -332,13 +332,24 @@
         } else {                /* n is 0 */
             tn_array *pkgs;
             if ((pkgs = pkgset_search_reqdir(ps, NULL, reqname))) {
+                int i;
                 n = 0;
+
+                for (i=0; i < n_array_size(pkgs); i++) {
+                    pkgsbuf[n++] = n_array_nth(pkgs, i);
+                    if (n == pkgsbuf_size)
+                        break;
+                }
+
+/* XXX: TOFIX: pkgsbuf is not free()d by caller, so pkg _refcnts must
+   be decreased here */
+#if 0  
                 while (n_array_size(pkgs)) {
                     pkgsbuf[n++] = n_array_shift(pkgs);
                     if (n == pkgsbuf_size)
                         break;
                 }
-                
+#endif                
                 *npkgs = n;
                 if (n) {
                     matched = 1;
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/poldek/poldek/pkg.c?r1=1.111&r2=1.112&f=u
    http://cvs.pld-linux.org/poldek/poldek/pkgmark.c?r1=1.7&r2=1.8&f=u
    http://cvs.pld-linux.org/poldek/poldek/pkgset-req.c?r1=1.45&r2=1.46&f=u



More information about the pld-cvs-commit mailing list