about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-10-27 13:33:26 +0100
committerMike Frysinger <vapier@gentoo.org>2016-01-24 03:55:26 -0500
commita73a62562a198072ab417e28d4c0315a78c49cfe (patch)
tree67b189a969ab2c40f5c3ac4165d513f02f71b73a
parent7ad78f869815a73dc26c93b72d156812d93eb026 (diff)
downloadglibc-a73a62562a198072ab417e28d4c0315a78c49cfe.tar.gz
glibc-a73a62562a198072ab417e28d4c0315a78c49cfe.tar.xz
glibc-a73a62562a198072ab417e28d4c0315a78c49cfe.zip
Gracefully handle incompatible locale data
* locale/loadlocale.c (_nl_intern_locale_data): Change assertion
on CNT to a conditional jump to 'puntdata'.

(cherry picked from commit 0062ace2292effc4135c15ea99b1931fea5e0203)
-rw-r--r--ChangeLog5
-rw-r--r--locale/loadlocale.c7
2 files changed, 9 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 0bde9e21f4..9740c89cab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-10-27  Ludovic Courtès  <ludo@gnu.org>
+
+	* locale/loadlocale.c (_nl_intern_locale_data): Change assertion
+	on CNT to a conditional jump to 'puntdata'.
+
 2015-08-18  Alan Modra  <amodra@gmail.com>
 
 	[BZ #18421]
diff --git a/locale/loadlocale.c b/locale/loadlocale.c
index fdba6e93c4..dcbb833a16 100644
--- a/locale/loadlocale.c
+++ b/locale/loadlocale.c
@@ -121,9 +121,10 @@ _nl_intern_locale_data (int category, const void *data, size_t datasize)
       switch (category)
 	{
 #define CATTEST(cat) \
-	case LC_##cat:							      \
-	  assert (cnt < (sizeof (_nl_value_type_LC_##cat)		      \
-			 / sizeof (_nl_value_type_LC_##cat[0])));	      \
+	case LC_##cat:						\
+	  if (cnt >= (sizeof (_nl_value_type_LC_##cat)		\
+		      / sizeof (_nl_value_type_LC_##cat[0])))	\
+	    goto puntdata;					\
 	  break
 	  CATTEST (NUMERIC);
 	  CATTEST (TIME);