r5808 - in glibc-package/trunk/debian: . patches patches/any
Author: aurel32
Date: 2013-11-29 15:43:12 +0000 (Fri, 29 Nov 2013)
New Revision: 5808
Added:
glibc-package/trunk/debian/patches/any/submitted-findlocale-div-by-zero.diff
Modified:
glibc-package/trunk/debian/changelog
glibc-package/trunk/debian/patches/series
Log:
* patches/any/submitted-findlocale-div-by-zero.diff: new patch to fix
a SIGFPE when locale-archive has been corrupted to all zeros (Closes:
#718890, #730336).
Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog 2013-11-29 14:34:18 UTC (rev 5807)
+++ glibc-package/trunk/debian/changelog 2013-11-29 15:43:12 UTC (rev 5808)
@@ -6,6 +6,9 @@
* patches/mips/local-prlimit64.diff: remove.
* patches/mips/cvs-prlimit64.diff: new patch from upstream to fix
getrlimit64/setrlimit64 with recent 64-bit kernels (Closes: #665897).
+ * patches/any/submitted-findlocale-div-by-zero.diff: new patch to fix
+ a SIGFPE when locale-archive has been corrupted to all zeros (Closes:
+ #718890, #730336).
[ Petr Salinger ]
* kfreebsd/local-sysdeps.diff: raise MAXLOGNAME
Added: glibc-package/trunk/debian/patches/any/submitted-findlocale-div-by-zero.diff
===================================================================
--- glibc-package/trunk/debian/patches/any/submitted-findlocale-div-by-zero.diff (rev 0)
+++ glibc-package/trunk/debian/patches/any/submitted-findlocale-div-by-zero.diff 2013-11-29 15:43:12 UTC (rev 5808)
@@ -0,0 +1,33 @@
+From 437065b1f485c84051c5ff9a027edb03bdfec61c Mon Sep 17 00:00:00 2001
+From: Aurelien Jarno <aurelien@aurel32.net>
+Date: Fri, 29 Nov 2013 16:28:17 +0100
+Subject: [PATCH] locale: don't crash if locale-archive is an empty file
+
+In case of power failure followed by filesystem issues locale-archive
+can end-up containing all zeros. In that case all calls to setlocale()
+generate a SIGFPE. This renders a system with a default non-C locale
+unbootable.
+
+Avoid this by ignoring the locale instead of generating a SIGFPE.
+---
+ locale/loadarchive.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/locale/loadarchive.c b/locale/loadarchive.c
+index 70136dc..7cfc498 100644
+--- a/locale/loadarchive.c
++++ b/locale/loadarchive.c
+@@ -274,6 +274,10 @@ _nl_load_locale_from_archive (int category, const char **namep)
+ namehashtab = (struct namehashent *) ((char *) head
+ + head->namehash_offset);
+
++ /* Avoid division by 0 if the file is corrupted. */
++ if (__builtin_expect (head->namehash_size == 0, 0))
++ goto close_and_out;
++
+ idx = hval % head->namehash_size;
+ incr = 1 + hval % (head->namehash_size - 2);
+
+--
+1.8.4.2
+
Modified: glibc-package/trunk/debian/patches/series
===================================================================
--- glibc-package/trunk/debian/patches/series 2013-11-29 14:34:18 UTC (rev 5807)
+++ glibc-package/trunk/debian/patches/series 2013-11-29 15:43:12 UTC (rev 5808)
@@ -269,3 +269,4 @@
any/cvs-CVE-2013-4788-static-ptrguard-ppc64.diff
any/cvs-CVE-2013-4788-static-ptrguard-arm.diff
any/unsubmitted-dlopen-static-crash.diff
+any/submitted-findlocale-div-by-zero.diff
Reply to: