From 6bee5d1fc3c1cb824fd4ebadb24da613d0d5b140 Mon Sep 17 00:00:00 2001 From: Patsy Franklin Date: Tue, 11 Dec 2012 11:50:55 -0500 Subject: [PATCH] - Backport fix for nss_db crash when db contains exactly one entry.(#878913) --- glibc-rh878913.patch | 32 ++++++++++++++++++++++++++++++++ glibc.spec | 9 ++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 glibc-rh878913.patch diff --git a/glibc-rh878913.patch b/glibc-rh878913.patch new file mode 100644 index 0000000..822bdee --- /dev/null +++ b/glibc-rh878913.patch @@ -0,0 +1,32 @@ +--- a/nss/makedb.c ++++ b/nss/makedb.c +@@ -591,13 +591,16 @@ copy_valstr (const void *nodep, const VISIT which, const int depth) + } + + ++/* Determine if the candidate is prime by using a modified trial division ++ algorithm. The candidate must be both odd and greater than 4. */ + static int + is_prime (size_t candidate) + { +- /* No even number and none less than 10 will be passed here. */ + size_t divn = 3; + size_t sq = divn * divn; + ++ assert (candidate > 4 && candidate % 2 != 0); ++ + while (sq < candidate && candidate % divn != 0) + { + ++divn; +@@ -612,8 +615,8 @@ is_prime (size_t candidate) + static size_t + next_prime (size_t seed) + { +- /* Make it definitely odd. */ +- seed |= 1; ++ /* Make sure that we're always greater than 4. */ ++ seed = (seed + 4) | 1; + + while (!is_prime (seed)) + seed += 2; + diff --git a/glibc.spec b/glibc.spec index 2a9d706..51bf9b9 100644 --- a/glibc.spec +++ b/glibc.spec @@ -28,7 +28,7 @@ Summary: The GNU libc libraries Name: glibc Version: %{glibcversion} -Release: 27%{?dist} +Release: 28%{?dist} # GPLv2+ is used in a bunch of programs, LGPLv2+ is used for libraries. # Things that are linked directly into dynamically linked programs # and shared libraries (e.g. crt files, lib*_nonshared.a) have an additional @@ -196,6 +196,9 @@ Patch2041: %{name}-rh577950.patch Patch2042: %{name}-rh864820.patch +#See http://sourceware.org/ml/libc-alpha/2012-11/msg00747.html +Patch2043: %{name}-rh878913.patch + Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Obsoletes: glibc-profile < 2.4 Obsoletes: nss_db @@ -475,6 +478,7 @@ rm -rf %{glibcportsdir} %patch1049 -p1 %patch1050 -p1 %patch1051 -p1 +%patch2043 -p1 # On powerpc32, hp timing is only available in power4/power6 # libs, not in base, so pre-power4 dynamic linker is incompatible @@ -1281,6 +1285,9 @@ rm -f *.filelist* %endif %changelog +* Mon Dec 10 2012 Patsy Franklin - 2.16-28 + - Backport fix for nss_db crash when db contains exactly one entry.(#878913) + * Thu Dec 7 2012 Patsy Franklin - 2.16-27 - Backport crypto support from upstream. (#811753)