|
|
29e444 |
2013-05-03 Carlos O'Donell <carlos at redhat.com>
|
|
|
29e444 |
|
|
|
29e444 |
* intl/dcigettext.c (DCIGETTEXT): Skip translating if _nl_find_msg returns -1.
|
|
|
29e444 |
(_nl_find_msg): Return -1 if recursive call returned -1. If newmem is null
|
|
|
29e444 |
return -1.
|
|
|
29e444 |
* intl/loadmsgcat.c (_nl_load_domain): If _nl_find_msg returns -1 abort
|
|
|
29e444 |
loading the domain.
|
|
|
29e444 |
|
|
|
12745e |
diff --git glibc-2.17-c758a686/intl/dcigettext.c glibc-2.17-c758a686/intl/dcigettext.c
|
|
|
29e444 |
index 110307b..f4aa215 100644
|
|
|
12745e |
--- glibc-2.17-c758a686/intl/dcigettext.c
|
|
|
12745e |
+++ glibc-2.17-c758a686/intl/dcigettext.c
|
|
|
29e444 |
@@ -638,6 +638,11 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category)
|
|
|
29e444 |
retval = _nl_find_msg (domain->successor[cnt], binding,
|
|
|
29e444 |
msgid1, 1, &retlen);
|
|
|
29e444 |
|
|
|
29e444 |
+ /* Resource problems are not fatal, instead we return no
|
|
|
29e444 |
+ translation. */
|
|
|
29e444 |
+ if (__builtin_expect (retval == (char *) -1, 0))
|
|
|
29e444 |
+ goto no_translation;
|
|
|
29e444 |
+
|
|
|
29e444 |
if (retval != NULL)
|
|
|
29e444 |
{
|
|
|
29e444 |
domain = domain->successor[cnt];
|
|
|
29e444 |
@@ -941,6 +946,11 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
|
|
|
29e444 |
nullentry =
|
|
|
29e444 |
_nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen);
|
|
|
29e444 |
|
|
|
29e444 |
+ /* Resource problems are fatal. If we continue onwards we will
|
|
|
29e444 |
+ only attempt to calloc a new conv_tab and fail later. */
|
|
|
29e444 |
+ if (__builtin_expect (nullentry == (char *) -1, 0))
|
|
|
29e444 |
+ return (char *) -1;
|
|
|
29e444 |
+
|
|
|
29e444 |
if (nullentry != NULL)
|
|
|
29e444 |
{
|
|
|
29e444 |
const char *charsetstr;
|
|
|
29e444 |
@@ -1170,10 +1180,14 @@ _nl_find_msg (domain_file, domainbinding, msgid, convert, lengthp)
|
|
|
29e444 |
freemem_size = INITIAL_BLOCK_SIZE;
|
|
|
29e444 |
newmem = (transmem_block_t *) malloc (freemem_size);
|
|
|
29e444 |
# ifdef _LIBC
|
|
|
29e444 |
- /* Add the block to the list of blocks we have to free
|
|
|
29e444 |
- at some point. */
|
|
|
29e444 |
- newmem->next = transmem_list;
|
|
|
29e444 |
- transmem_list = newmem;
|
|
|
29e444 |
+ if (newmem != NULL)
|
|
|
29e444 |
+ {
|
|
|
29e444 |
+ /* Add the block to the list of blocks we have to free
|
|
|
29e444 |
+ at some point. */
|
|
|
29e444 |
+ newmem->next = transmem_list;
|
|
|
29e444 |
+ transmem_list = newmem;
|
|
|
29e444 |
+ }
|
|
|
29e444 |
+ /* Fall through and return -1. */
|
|
|
29e444 |
# endif
|
|
|
29e444 |
}
|
|
|
29e444 |
if (__builtin_expect (newmem == NULL, 0))
|
|
|
12745e |
diff --git glibc-2.17-c758a686/intl/loadmsgcat.c glibc-2.17-c758a686/intl/loadmsgcat.c
|
|
|
29e444 |
index e4b7b38..ac90ed1 100644
|
|
|
12745e |
--- glibc-2.17-c758a686/intl/loadmsgcat.c
|
|
|
12745e |
+++ glibc-2.17-c758a686/intl/loadmsgcat.c
|
|
|
29e444 |
@@ -1237,7 +1237,7 @@ _nl_load_domain (domain_file, domainbinding)
|
|
|
29e444 |
default:
|
|
|
29e444 |
/* This is an invalid revision. */
|
|
|
29e444 |
invalid:
|
|
|
29e444 |
- /* This is an invalid .mo file. */
|
|
|
29e444 |
+ /* This is an invalid .mo file or we ran out of resources. */
|
|
|
29e444 |
free (domain->malloced);
|
|
|
29e444 |
#ifdef HAVE_MMAP
|
|
|
29e444 |
if (use_mmap)
|
|
|
29e444 |
@@ -1257,6 +1257,11 @@ _nl_load_domain (domain_file, domainbinding)
|
|
|
29e444 |
|
|
|
29e444 |
/* Get the header entry and look for a plural specification. */
|
|
|
29e444 |
nullentry = _nl_find_msg (domain_file, domainbinding, "", 0, &nullentrylen);
|
|
|
29e444 |
+ if (__builtin_expect (nullentry == (char *) -1, 0))
|
|
|
29e444 |
+ {
|
|
|
29e444 |
+ __libc_rwlock_fini (domain->conversions_lock);
|
|
|
29e444 |
+ goto invalid;
|
|
|
29e444 |
+ }
|
|
|
29e444 |
EXTRACT_PLURAL_EXPRESSION (nullentry, &domain->plural, &domain->nplurals);
|
|
|
29e444 |
|
|
|
29e444 |
out:
|