]> TLD Linux GIT Repositories - packages/rpm.git/blobdiff - rpm-div0.patch
- fixed division by zero when processing deps
[packages/rpm.git] / rpm-div0.patch
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;