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