]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Gracefully handle incompatible locale data
authorLudovic Courtès <ludo@gnu.org>
Tue, 27 Oct 2015 12:33:26 +0000 (13:33 +0100)
committerMike Frysinger <vapier@gentoo.org>
Tue, 16 Feb 2016 19:16:00 +0000 (14:16 -0500)
* locale/loadlocale.c (_nl_intern_locale_data): Change assertion
on CNT to a conditional jump to 'puntdata'.

(cherry picked from commit 0062ace2292effc4135c15ea99b1931fea5e0203)
(cherry picked from commit 84f80d5ea11fb3b6325c18c31ba0a6a99d5f68bb)

locale/loadlocale.c

index fdba6e93c4cd3e400062f57f31b1633df78902c9..dcbb833a16d7845059816cd17ff132d928feca04 100644 (file)
@@ -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);