public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Lubos Kardos <lkardos@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/rpm] pmatilai-v6: - Fix crash when parsing corrupted RPM file
Date: Mon, 23 Nov 2026 09:29:43 GMT	[thread overview]
Message-ID: <179542618331.1.9341594403248967926.rpms-rpm-f5452710217c@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/rpm
            Branch : pmatilai-v6
            Commit : f5452710217c714bdbea7b49b83c069c0ba476d7
            Author : Lubos Kardos <lkardos@redhat.com>
            Date   : 2015-11-06T16:24:27+01:00
            Stats  : +64/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/rpm/c/f5452710217c714bdbea7b49b83c069c0ba476d7?branch=pmatilai-v6

            Log:
            - Fix crash when parsing corrupted RPM file
- Resolves: #1273360

---
diff --git a/rpm-4.13.0-fix-crash-on-corrupted.patch b/rpm-4.13.0-fix-crash-on-corrupted.patch
new file mode 100644
index 0000000..fd93a54
--- /dev/null
+++ b/rpm-4.13.0-fix-crash-on-corrupted.patch
@@ -0,0 +1,59 @@
+From 9c36ca411332d2718eca339e867561c39abc256b Mon Sep 17 00:00:00 2001
+From: Lubos Kardos <lkardos@redhat.com>
+Date: Fri, 6 Nov 2015 14:49:59 +0100
+Subject: [PATCH] Fix crash when parsing corrupted RPM file (rhbz:1273360)
+
+---
+ lib/legacy.c | 14 ++++++++------
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/lib/legacy.c b/lib/legacy.c
+index 422c2b0..8ba7bbd 100644
+--- a/lib/legacy.c
++++ b/lib/legacy.c
+@@ -25,7 +25,7 @@ static void compressFilelist(Header h)
+     char ** dirNames;
+     const char ** baseNames;
+     uint32_t * dirIndexes;
+-    rpm_count_t count;
++    rpm_count_t count, realCount = 0;
+     int i;
+     int dirIndex = -1;
+ 
+@@ -58,6 +58,7 @@ static void compressFilelist(Header h)
+ 	    while ((i = rpmtdNext(&fileNames)) >= 0) {
+ 		dirIndexes[i] = dirIndex;
+ 		baseNames[i] = rpmtdGetString(&fileNames);
++		realCount++;
+ 	    }
+ 	    goto exit;
+ 	}
+@@ -87,19 +88,20 @@ static void compressFilelist(Header h)
+ 	    (needle = bsearch(&filename, dirNames, dirIndex + 1, sizeof(dirNames[0]), dncmp)) == NULL) {
+ 	    char *s = xmalloc(len + 1);
+ 	    rstrlcpy(s, filename, len + 1);
+-	    dirIndexes[i] = ++dirIndex;
++	    dirIndexes[realCount] = ++dirIndex;
+ 	    dirNames[dirIndex] = s;
+ 	} else
+-	    dirIndexes[i] = needle - dirNames;
++	    dirIndexes[realCount] = needle - dirNames;
+ 
+ 	*baseName = savechar;
+-	baseNames[i] = baseName;
++	baseNames[realCount] = baseName;
++	realCount++;
+     }
+ 
+ exit:
+     if (count > 0) {
+-	headerPutUint32(h, RPMTAG_DIRINDEXES, dirIndexes, count);
+-	headerPutStringArray(h, RPMTAG_BASENAMES, baseNames, count);
++	headerPutUint32(h, RPMTAG_DIRINDEXES, dirIndexes, realCount);
++	headerPutStringArray(h, RPMTAG_BASENAMES, baseNames, realCount);
+ 	headerPutStringArray(h, RPMTAG_DIRNAMES, 
+ 			     (const char **) dirNames, dirIndex + 1);
+     }
+-- 
+1.9.3
+

diff --git a/rpm.spec b/rpm.spec
index 4cd97b0..5d57aa6 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}.}10%{?dist}
+Release: %{?snapver:0.%{snapver}.}11%{?dist}
 Group: System Environment/Base
 Url: http://www.rpm.org/
 Source0: http://rpm.org/releases/rpm-4.12.x/%{name}-%{srcver}.tar.bz2
@@ -61,6 +61,7 @@ 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
+Patch109: rpm-4.13.0-fix-crash-on-corrupted.patch
 
 # These are not yet upstream
 Patch302: rpm-4.7.1-geode-i686.patch
@@ -565,6 +566,9 @@ exit 0
 %doc doc/librpm/html/*
 
 %changelog
+* Fri Nov 06 2015 Lubos Kardos <lkardos@rpm.org> - 4.13.0-0.rc1.11
+- Fix crash when parsing corrupted RPM file (#1273360)
+
 * Fri Nov 06 2015 Lubos Kardos <lkardos@rpm.org> - 4.13.0-0.rc1.10
 - Fix SIGSEGV in case of old unsupported gpg keys (#1277464)
 

                 reply	other threads:[~2026-11-23  9:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179542618331.1.9341594403248967926.rpms-rpm-f5452710217c@fedoraproject.org \
    --to=lkardos@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox