]> git.pld-linux.org Git - packages/glibc.git/blob - glibc-graceful-locale.patch
- rel 10; fixes from stable git branch
[packages/glibc.git] / glibc-graceful-locale.patch
1 From: ludo at gnu dot org (Ludovic =?utf-8?Q?Court=C3=A8s?=)
2 To: libc-alpha at sourceware dot org
3 Subject: [PATCH] Gracefully handle incompatible locale data
4 Date: Tue, 22 Sep 2015 17:27:55 +0200
5
6 With libc 2.22 people are starting to realize that libc does not
7 guarantee that it can load locale data built with another libc version,
8 but they learn it the hard way:
9
10   loadlocale.c:130: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_v=
11 alue_type_LC_COLLATE) / sizeof (_nl_value_type_LC_COLLATE[0]))' failed.
12
13 This patch changes such conditions to return EINVAL instead of aborting.
14
15 WDYT?
16
17 Thanks,
18 Ludo=E2=80=99.
19
20 2015-10-22  Ludovic Court=C3=A8s  <ludo@gnu.org>
21
22         * locale/loadlocale.c (_nl_intern_locale_data): Change assertion
23         on CNT to a conditional jump to 'puntdata'.
24
25
26 --- glibc-2.22/locale/loadlocale.c~     2015-08-05 08:42:21.000000000 +0200
27 +++ glibc-2.22/locale/loadlocale.c      2015-10-17 22:29:26.612455638 +0200
28 @@ -122,8 +122,9 @@ _nl_intern_locale_data (int category, co
29         {
30  #define CATTEST(cat) \
31         case LC_##cat:                                                        \
32 -         assert (cnt < (sizeof (_nl_value_type_LC_##cat)                     \
33 -                        / sizeof (_nl_value_type_LC_##cat[0])));             \
34 +         if (cnt >= (sizeof (_nl_value_type_LC_##cat)                \
35 +                        / sizeof (_nl_value_type_LC_##cat[0])))              \
36 +               goto puntdata; \
37           break
38           CATTEST (NUMERIC);
39           CATTEST (TIME);
This page took 0.036904 seconds and 3 git commands to generate.