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=2d5e9185aa3582ff62f34ec3c66feea4439f9f03

commit 2d5e9185aa3582ff62f34ec3c66feea4439f9f03
Author: Guillem Jover <guil...@debian.org>
AuthorDate: Fri May 18 10:13:48 2018 +0200

    dpkg: Call ensure_package_clientdata() defensively
    
    We want to stop calling this function from the fsys loading code, so we
    should make very sure it is being called before we access the clientdata
    members, otherwise we'll just segfault.
---
 debian/changelog | 1 +
 src/archives.c   | 2 ++
 src/configure.c  | 2 ++
 src/remove.c     | 2 ++
 src/trigproc.c   | 2 ++
 src/unpack.c     | 1 +
 6 files changed, 10 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index c29836791..a724b285f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -177,6 +177,7 @@ dpkg (1.19.1) UNRELEASED; urgency=medium
     - libdpkg: Add new pkg_name() and pkgbin_name() const variants.
     - 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.
   * Build system:
     - Set distribution tarball format to ustar, instead of default v7 format.
     - Mark PO4A and POD2MAN as precious variables.
diff --git a/src/archives.c b/src/archives.c
index 6d73375ab..9b736a5d9 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -843,6 +843,8 @@ tarobject(void *ctx, struct tar_entry *ti)
         continue;
       }
 
+      ensure_package_clientdata(otherpkg);
+
       /* Nope? Hmm, file conflict, perhaps. Check Replaces. */
       switch (otherpkg->clientdata->replacingfilesandsaid) {
       case 2:
diff --git a/src/configure.c b/src/configure.c
index 211663c18..720812b38 100644
--- a/src/configure.c
+++ b/src/configure.c
@@ -609,6 +609,7 @@ deferred_configure(struct pkginfo *pkg)
        ok = dependencies_ok(pkg, NULL, &aemsgs);
        if (ok == DEP_CHECK_DEFER) {
                varbuf_destroy(&aemsgs);
+               ensure_package_clientdata(pkg);
                pkg->clientdata->istobe = PKG_ISTOBE_INSTALLNEW;
                enqueue_package(pkg);
                return;
@@ -653,6 +654,7 @@ deferred_configure(struct pkginfo *pkg)
 
        if (f_noact) {
                pkg_set_status(pkg, PKG_STAT_INSTALLED);
+               ensure_package_clientdata(pkg);
                pkg->clientdata->istobe = PKG_ISTOBE_NORMAL;
                return;
        }
diff --git a/src/remove.c b/src/remove.c
index 45c9a9e3e..cce7685c4 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -102,6 +102,8 @@ void deferred_remove(struct pkginfo *pkg) {
       modstatdb_note(pkg);
   }
 
+  ensure_package_clientdata(pkg);
+
   if (pkg->status == PKG_STAT_NOTINSTALLED) {
     sincenothing = 0;
     warning(_("ignoring request to remove %.250s which isn't installed"),
diff --git a/src/trigproc.c b/src/trigproc.c
index 70a42eaa2..ef59455e3 100644
--- a/src/trigproc.c
+++ b/src/trigproc.c
@@ -160,6 +160,7 @@ trigproc_run_deferred(void)
                push_error_context_jump(&ejbuf, print_error_perpackage,
                                        pkg_name(pkg, pnaw_nonambig));
 
+               ensure_package_clientdata(pkg);
                pkg->clientdata->trigprocdeferred = NULL;
                trigproc(pkg, TRIGPROC_TRY);
 
@@ -362,6 +363,7 @@ trigproc(struct pkginfo *pkg, enum trigproc_type type)
 
        debug(dbg_triggers, "trigproc %s", pkg_name(pkg, pnaw_always));
 
+       ensure_package_clientdata(pkg);
        if (pkg->clientdata->trigprocdeferred)
                pkg->clientdata->trigprocdeferred->pkg = NULL;
        pkg->clientdata->trigprocdeferred = NULL;
diff --git a/src/unpack.c b/src/unpack.c
index 0ab4175e2..970871a3a 100644
--- a/src/unpack.c
+++ b/src/unpack.c
@@ -207,6 +207,7 @@ pkg_check_depcon(struct pkginfo *pkg, const char *pfilename)
 
   /* Check if anything is installed that we conflict with, or not installed
    * that we need. */
+  ensure_package_clientdata(pkg);
   pkg->clientdata->istobe = PKG_ISTOBE_INSTALLNEW;
 
   for (dsearch = pkg->available.depends; dsearch; dsearch = dsearch->next) {

-- 
Dpkg.Org's dpkg

Reply via email to