From 6b91893f65d6ff7d98c6482599fa723905754f77 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Fri, 16 Aug 2019 10:56:50 +0200 Subject: [PATCH] - fixed division by zero when processing deps --- rpm-div0.patch | 24 ++++++++++++++++++++++++ rpm.spec | 4 +++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 rpm-div0.patch diff --git a/rpm-div0.patch b/rpm-div0.patch new file mode 100644 index 0000000..54775bd --- /dev/null +++ b/rpm-div0.patch @@ -0,0 +1,24 @@ +diff -ur rpm-4.5.orig/lib/rpmds.c rpm-4.5/lib/rpmds.c +--- rpm-4.5.orig/lib/rpmds.c 2019-06-01 18:55:39.433000000 +0200 ++++ rpm-4.5/lib/rpmds.c 2019-08-16 10:50:36.274000000 +0200 +@@ -3008,6 +3008,8 @@ + case SHT_DYNAMIC: + data = NULL; + while ((data = elf_getdata (scn, data)) != NULL) { ++ if (shdr->sh_entsize == 0) ++ continue; + /*@-boundswrite@*/ + for (cnt = 0; cnt < (shdr->sh_size / shdr->sh_entsize); ++cnt) { + dyn = gelf_getdyn (data, cnt, &dyn_mem); +diff -ur rpm-4.5.orig/rpmdb/legacy.c rpm-4.5/rpmdb/legacy.c +--- rpm-4.5.orig/rpmdb/legacy.c 2007-07-30 04:28:13.000000000 +0200 ++++ rpm-4.5/rpmdb/legacy.c 2019-08-16 10:35:01.076000000 +0200 +@@ -99,7 +99,7 @@ + /*@-branchstate -uniondef @*/ + while (!bingo && (scn = elf_nextscn(elf, scn)) != NULL) { + (void) gelf_getshdr(scn, &shdr); +- if (shdr.sh_type != SHT_DYNAMIC) ++ if (shdr.sh_type != SHT_DYNAMIC || shdr.sh_entsize == 0) + continue; + while (!bingo && (data = elf_getdata (scn, data)) != NULL) { + int maxndx = data->d_size / shdr.sh_entsize; diff --git a/rpm.spec b/rpm.spec index 64751f5..66c105e 100644 --- a/rpm.spec +++ b/rpm.spec @@ -42,7 +42,7 @@ Summary(ru.UTF-8): Менеджер пакетов от RPM Summary(uk.UTF-8): Менеджер пакетів від RPM Name: rpm Version: 4.5 -Release: 87 +Release: 88 License: LGPL Group: Base Source0: %{name}-%{version}.tar.gz @@ -178,6 +178,7 @@ Patch115: %{name}-glibc.patch Patch116: %{name}-trigger-flags-int-type.patch Patch117: %{name}-rpm2cpio-xz.patch Patch118: %{name}-noarch-subpackages.patch +Patch119: %{name}-div0.patch URL: http://rpm5.org/ BuildRequires: autoconf >= 2.57 BuildRequires: automake >= 1.4 @@ -823,6 +824,7 @@ install %{SOURCE13} scripts/perl.prov %patch116 -p1 %patch117 -p1 %patch118 -p1 +%patch119 -p1 mv -f po/{sr,sr@Latn}.po rm -rf sqlite zlib popt -- 2.46.0