This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=abcf523423776b2042a10bf2e05c93475f6eb1ea

commit abcf523423776b2042a10bf2e05c93475f6eb1ea
Author: Guillem Jover <[email protected]>
AuthorDate: Fri May 18 10:13:48 2018 +0200

    dpkg: Check that clientdata is allocated before using it
    
    For functions that are supposed to just check the state of a package in
    a read-only way, make sure the clientdata is allocated, instead of just
    calling ensure_package_clientdata().
---
 debian/changelog | 2 ++
 src/depcon.c     | 3 ++-
 src/packages.c   | 3 ++-
 src/remove.c     | 1 +
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a724b285f..a7ed64367 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -178,6 +178,8 @@ dpkg (1.19.1) UNRELEASED; urgency=medium
     - libdpkg, dselect: Use new pkg_name_const() and pkgbin_name_const().
     - libdpkg: Rename struct pkginfo files member to archives.
     - dpkg: Call ensure_package_clientdata() defensively.
+    - dpkg: For read-only state functions, check that clientdata is allocated
+      before using it.
   * Build system:
     - Set distribution tarball format to ustar, instead of default v7 format.
     - Mark PO4A and POD2MAN as precious variables.
diff --git a/src/depcon.c b/src/depcon.c
index 560190c1f..55f08ef08 100644
--- a/src/depcon.c
+++ b/src/depcon.c
@@ -75,7 +75,8 @@ deppossi_pkg_iter_next(struct deppossi_pkg_iterator *iter)
       pkgbin = &pkg_cur->available;
       break;
     case wpb_by_istobe:
-      if (pkg_cur->clientdata->istobe == PKG_ISTOBE_INSTALLNEW)
+      if (pkg_cur->clientdata &&
+          pkg_cur->clientdata->istobe == PKG_ISTOBE_INSTALLNEW)
         pkgbin = &pkg_cur->available;
       else
         pkgbin = &pkg_cur->installed;
diff --git a/src/packages.c b/src/packages.c
index da221c093..b78d6ffe9 100644
--- a/src/packages.c
+++ b/src/packages.c
@@ -438,7 +438,8 @@ deppossi_ok_found(struct pkginfo *possdependee, struct 
pkginfo *requiredby,
 
       if (removing ||
           !(f_triggers ||
-            possdependee->clientdata->istobe == PKG_ISTOBE_INSTALLNEW)) {
+            (possdependee->clientdata &&
+             possdependee->clientdata->istobe == PKG_ISTOBE_INSTALLNEW))) {
         if (provider) {
           varbuf_printf(oemsgs,
                         _("  Package %s which provides %s awaits trigger 
processing.\n"),
diff --git a/src/remove.c b/src/remove.c
index cce7685c4..6eb2e5d90 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -75,6 +75,7 @@ static void checkforremoval(struct pkginfo *pkgtoremove,
     varbuf_snapshot(raemsgs, &raemsgs_state);
     ok= dependencies_ok(depender,pkgtoremove,raemsgs);
     if (ok == DEP_CHECK_HALT &&
+        depender->clientdata &&
         depender->clientdata->istobe == PKG_ISTOBE_REMOVE)
       ok = DEP_CHECK_DEFER;
     if (ok == DEP_CHECK_DEFER)

-- 
Dpkg.Org's dpkg

Reply via email to