You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rpm/SOURCES/0001-Don-t-segfault-on-miss...

41 lines
1.4 KiB

From 91ed417e8cc0a4f1ed45b1d8f6242c2ef9f441d3 Mon Sep 17 00:00:00 2001
From: Florian Festi <ffesti@redhat.com>
Date: Fri, 20 Aug 2021 15:14:16 +0200
Subject: [PATCH 1/5] Don't segfault on missing priority tag
(cherry picked from commit fd57fc716231c8296d340fdb4c0f6eac176f7f7c)
Fixes: RHEL-39894
---
lib/rpmtriggers.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/rpmtriggers.c b/lib/rpmtriggers.c
index c652981be..a9e63a241 100644
--- a/lib/rpmtriggers.c
+++ b/lib/rpmtriggers.c
@@ -523,7 +523,8 @@ rpmRC runFileTriggers(rpmts ts, rpmte te, rpmsenseFlags sense,
if (matchFunc(ts, te, pfx, sense)) {
for (i = 0; i < rpmdbIndexIteratorNumPkgs(ii); i++) {
struct rpmtd_s priorities;
- unsigned int priority;
+ unsigned int priority = 0;
+ unsigned int *priority_ptr;
unsigned int offset = rpmdbIndexIteratorPkgOffset(ii, i);
unsigned int tix = rpmdbIndexIteratorTagNum(ii, i);
@@ -541,7 +542,9 @@ rpmRC runFileTriggers(rpmts ts, rpmte te, rpmsenseFlags sense,
trigH = rpmdbGetHeaderAt(rpmtsGetRdb(ts), offset);
headerGet(trigH, priorityTag, &priorities, HEADERGET_MINMEM);
rpmtdSetIndex(&priorities, tix);
- priority = *rpmtdGetUint32(&priorities);
+ priority_ptr = rpmtdGetUint32(&priorities);
+ if (priority_ptr)
+ priority = *priority_ptr;
headerFree(trigH);
/* Store file trigger in array */
--
2.47.0