]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/glibc/glibc-rh834386-2.patch
dhcpcd: fix delay after dhcp down.
[ipfire-2.x.git] / src / patches / glibc / glibc-rh834386-2.patch
CommitLineData
30a4e827
MT
12013-05-03 Carlos O'Donell <carlos at redhat.com>
2
3 * intl/dcigettext.c (DCIGETTEXT): Skip translating if _nl_find_msg returns -1.
4 (_nl_find_msg): Return -1 if recursive call returned -1. If newmem is null
5 return -1.
6 * intl/loadmsgcat.c (_nl_load_domain): If _nl_find_msg returns -1 abort
7 loading the domain.
8
9diff -Nrup a/intl/dcigettext.c b/intl/dcigettext.c
10--- a/intl/dcigettext.c 2010-05-04 07:27:23.000000000 -0400
11+++ b/intl/dcigettext.c 2013-08-01 00:11:54.616363264 -0400
12@@ -640,6 +640,11 @@ DCIGETTEXT (domainname, msgid1, msgid2,
13 retval = _nl_find_msg (domain->successor[cnt], binding,
14 msgid1, 1, &retlen);
15
16+ /* Resource problems are not fatal, instead we return no
17+ translation. */
18+ if (__builtin_expect (retval == (char *) -1, 0))
19+ goto no_translation;
20+
21 if (retval != NULL)
22 {
23 domain = domain->successor[cnt];
24@@ -943,6 +948,11 @@ _nl_find_msg (domain_file, domainbinding
25 nullentry =
26 _nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen);
27
28+ /* Resource problems are fatal. If we continue onwards we will
29+ only attempt to calloc a new conv_tab and fail later. */
30+ if (__builtin_expect (nullentry == (char *) -1, 0))
31+ return (char *) -1;
32+
33 if (nullentry != NULL)
34 {
35 const char *charsetstr;
36@@ -1156,7 +1166,7 @@ _nl_find_msg (domain_file, domainbinding
37 freemem_size);
38 # ifdef _LIBC
39 if (newmem != NULL)
40- transmem_list = transmem_list->next;
41+ transmem_list = newmem;
42 else
43 {
44 struct transmem_list *old = transmem_list;
45@@ -1171,6 +1181,16 @@ _nl_find_msg (domain_file, domainbinding
46 malloc_count = 1;
47 freemem_size = INITIAL_BLOCK_SIZE;
48 newmem = (transmem_block_t *) malloc (freemem_size);
49+# ifdef _LIBC
50+ if (newmem != NULL)
51+ {
52+ /* Add the block to the list of blocks we have to free
53+ at some point. */
54+ newmem->next = transmem_list;
55+ transmem_list = newmem;
56+ }
57+ /* Fall through and return -1. */
58+# endif
59 }
60 if (__builtin_expect (newmem == NULL, 0))
61 {
62@@ -1181,11 +1201,6 @@ _nl_find_msg (domain_file, domainbinding
63 }
64
65 # ifdef _LIBC
66- /* Add the block to the list of blocks we have to free
67- at some point. */
68- newmem->next = transmem_list;
69- transmem_list = newmem;
70-
71 freemem = (unsigned char *) newmem->data;
72 freemem_size -= offsetof (struct transmem_list, data);
73 # else
74@@ -1402,7 +1417,7 @@ get_output_charset (domainbinding)
75 return _NL_CURRENT (LC_CTYPE, CODESET);
76 # else
77 # if HAVE_ICONV
78- extern const char *locale_charset PARAMS ((void);
79+ extern const char *locale_charset PARAMS ((void));
80 return locale_charset ();
81 # endif
82 # endif
83diff -Nrup a/intl/loadmsgcat.c b/intl/loadmsgcat.c
84--- a/intl/loadmsgcat.c 2010-05-04 07:27:23.000000000 -0400
85+++ b/intl/loadmsgcat.c 2013-08-01 00:12:48.448237849 -0400
86@@ -1235,7 +1235,7 @@ _nl_load_domain (domain_file, domainbind
87 default:
88 /* This is an invalid revision. */
89 invalid:
90- /* This is an invalid .mo file. */
91+ /* This is an invalid .mo file or we ran out of resources. */
92 free (domain->malloced);
93 #ifdef HAVE_MMAP
94 if (use_mmap)
95@@ -1255,6 +1255,12 @@ _nl_load_domain (domain_file, domainbind
96
97 /* Get the header entry and look for a plural specification. */
98 nullentry = _nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen);
99+ if (__builtin_expect (nullentry == (char *) -1, 0))
100+ {
101+ __libc_rwlock_fini (domain->conversions_lock);
102+ goto invalid;
103+ }
104+
105 EXTRACT_PLURAL_EXPRESSION (nullentry, &domain->plural, &domain->nplurals);
106
107 out: