]> TLD Linux GIT Repositories - packages/rpm.git/commitdiff
- fixed division by zero when processing deps
authorMarcin Krol <hawk@tld-linux.org>
Fri, 16 Aug 2019 08:56:50 +0000 (10:56 +0200)
committerMarcin Krol <hawk@tld-linux.org>
Fri, 16 Aug 2019 08:56:50 +0000 (10:56 +0200)
rpm-div0.patch [new file with mode: 0644]
rpm.spec

diff --git a/rpm-div0.patch b/rpm-div0.patch
new file mode 100644 (file)
index 0000000..54775bd
--- /dev/null
@@ -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;
index 64751f57c60bc4c9373a18de102857f133ed56be..66c105ed9d5eb693bf0ea32e647384168c71d0e7 100644 (file)
--- 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