From aa8a7b2897b8ed3068fe7fb6a788e602dba50423 Mon Sep 17 00:00:00 2001 From: Lubos Kardos Date: Fri, 6 Nov 2015 13:10:56 +0100 Subject: [PATCH] Fix SIGSEGV in case of old unsupported gpg keys Resolves: #1277464 --- rpm-4.13.0-unsupported-keys.patch | 62 +++++++++++++++++++++++++++++++ rpm.spec | 6 ++- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 rpm-4.13.0-unsupported-keys.patch diff --git a/rpm-4.13.0-unsupported-keys.patch b/rpm-4.13.0-unsupported-keys.patch new file mode 100644 index 0000000..6603bbb --- /dev/null +++ b/rpm-4.13.0-unsupported-keys.patch @@ -0,0 +1,62 @@ +From 2dd06933726cf5191e05264901789f8e1da6e51d Mon Sep 17 00:00:00 2001 +From: Lubos Kardos +Date: Fri, 6 Nov 2015 12:45:32 +0100 +Subject: [PATCH] Fix SIGSEGV in case of old unsupported gpg keys + (rhbz:1277464) + +Regression from: a173d781a631a92524ce5be364c679ba19b3e321 +Adds also warning that gpg key is not supported. +--- + rpmio/rpmkeyring.c | 5 ++--- + rpmio/rpmpgp.c | 5 +++++ + 2 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/rpmio/rpmkeyring.c b/rpmio/rpmkeyring.c +index b6b5703..c3d2c19 100644 +--- a/rpmio/rpmkeyring.c ++++ b/rpmio/rpmkeyring.c +@@ -159,9 +159,8 @@ rpmPubkey *rpmGetSubkeys(rpmPubkey mainkey, int *count) + int pgpsubkeysCount = 0; + int i; + +- if (!pgpPrtParamsSubkeys(mainkey->pkt, mainkey->pktlen, mainkey->pgpkey, +- &pgpsubkeys, &pgpsubkeysCount)) { +- ++ if (mainkey && !pgpPrtParamsSubkeys(mainkey->pkt, mainkey->pktlen, ++ mainkey->pgpkey, &pgpsubkeys, &pgpsubkeysCount)) { + + subkeys = xmalloc(pgpsubkeysCount * sizeof(*subkeys)); + +diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c +index f020650..6f8d77b 100644 +--- a/rpmio/rpmpgp.c ++++ b/rpmio/rpmpgp.c +@@ -624,6 +624,7 @@ static int pgpPrtSig(pgpTag tag, const uint8_t *h, size_t hlen, + rc = pgpPrtSigParams(tag, v->pubkey_algo, v->sigtype, p, h, hlen, _digp); + } break; + default: ++ rpmlog(RPMLOG_WARNING, _("Unsupported version of key: V%d\n"), h[0]); + rc = 1; + break; + } +@@ -710,6 +711,8 @@ static int pgpPrtKey(pgpTag tag, const uint8_t *h, size_t hlen, + rc = pgpPrtPubkeyParams(v->pubkey_algo, p, h, hlen, _digp); + } + } break; ++ default: ++ rpmlog(RPMLOG_WARNING, _("Unsupported version of key: V%d\n"), h[0]); + } + return rc; + } +@@ -775,6 +778,8 @@ static int getFingerprint(const uint8_t *h, size_t hlen, pgpKeyID_t keyid) + } + + } break; ++ default: ++ rpmlog(RPMLOG_WARNING, _("Unsupported version of key: V%d\n"), h[0]); + } + return rc; + } +-- +1.9.3 + diff --git a/rpm.spec b/rpm.spec index cf1bb66..4cd97b0 100644 --- a/rpm.spec +++ b/rpm.spec @@ -29,7 +29,7 @@ Summary: The RPM package management system Name: rpm Version: %{rpmver} -Release: %{?snapver:0.%{snapver}.}9%{?dist} +Release: %{?snapver:0.%{snapver}.}10%{?dist} Group: System Environment/Base Url: http://www.rpm.org/ Source0: http://rpm.org/releases/rpm-4.12.x/%{name}-%{srcver}.tar.bz2 @@ -60,6 +60,7 @@ Patch104: rpm-4.13.0-memory-error.patch Patch105: rpm-4.13.0-rpmdeps-weakdep-support.patch Patch106: rpm-4.13.0-autopatch-fix.patch Patch107: rpm-4.13.0-ignore-sigpipe.patch +Patch108: rpm-4.13.0-unsupported-keys.patch # These are not yet upstream Patch302: rpm-4.7.1-geode-i686.patch @@ -564,6 +565,9 @@ exit 0 %doc doc/librpm/html/* %changelog +* Fri Nov 06 2015 Lubos Kardos - 4.13.0-0.rc1.10 +- Fix SIGSEGV in case of old unsupported gpg keys (#1277464) + * Fri Oct 30 2015 Lubos Kardos - 4.13.0-0.rc1.9 - Ignore SIGPIPE signals during execucton of scriptlets (#1264198)