- Backport fix for nss_db crash when db contains exactly one entry.(#878913)

This commit is contained in:
Patsy Franklin 2012-12-11 11:50:55 -05:00
parent 9d9d94d266
commit 6bee5d1fc3
2 changed files with 40 additions and 1 deletions

32
glibc-rh878913.patch Normal file
View File

@ -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;

View File

@ -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 <pfrankli@redhat.com> - 2.16-28
- Backport fix for nss_db crash when db contains exactly one entry.(#878913)
* Thu Dec 7 2012 Patsy Franklin <pfrankli@redhat.com> - 2.16-27
- Backport crypto support from upstream. (#811753)