glibc/intl
Carlos O'Donell 7a44c18fb4 Fix _nl_find_msg malloc failure case, and callers.
This patch fixes two issues, and perhaps should be two distinct commits,
but I present it here as one for the sake of completeness.

Commit 006dd86111 fails to check malloc's
return in intl/dcigettext.c (_nl_find_msg):
~~~
      freemem_size = INITIAL_BLOCK_SIZE;
      newmem = (transmem_block_t *) malloc (freemem_size);
...
      newmem->next = transmem_list;
      transmem_list = newmem;
~~~
If malloc fails then newmem is NULL then newmem->next results in a
fault.

The fix is easy enough, check for newmem != NULL, and fall through to
the error condition below which returns (char *) -1 e.g. resource error.

The problem is that returning (char *) -1  will break all sorts of other
code, so while what we did is correct, the real failure case fix is
slightly broader.

There are 4 other places where _nl_find_msg is called, one is OK, the
other three are fixed to handle -1 error return value.

No regressions on x86-64 or x86.

However, no regressions isn't really a useful metric for this code.

The change was tested as documented here:
http://sourceware.org/glibc/wiki/Testing/WhiteBox
using SystemTap for fault injection to simulate malloc failure.

---

2013-05-03  Carlos O'Donell  <carlos at redhat.com>

	[BZ #15441]
	* intl/dcigettext.c (DCIGETTEXT): Skip translating if _nl_find_msg
	returns -1.
	(_nl_find_msg): Return -1 if recursive call returned -1. If newmem is
	null return -1.
	* intl/loadmsgcat.c (_nl_load_domain): If _nl_find_msg returns -1 abort
	loading the domain.
2013-05-22 14:50:26 -04:00
..
bindtextdom.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dcgettext.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dcigettext.c Fix _nl_find_msg malloc failure case, and callers. 2013-05-22 14:50:26 -04:00
dcngettext.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
Depend Update. 2000-06-17 07:39:18 +00:00
dgettext.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
dngettext.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
explodename.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
finddomain.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
gettext.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
gettextP.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
gmo.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
hash-string.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
hash-string.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
l10nflist.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
libintl.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
loadinfo.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
loadmsgcat.c Fix _nl_find_msg malloc failure case, and callers. 2013-05-22 14:50:26 -04:00
locale.alias Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
localealias.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
Makefile Remove bounded-pointers build system support. 2013-02-15 15:07:54 +00:00
ngettext.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
plural-eval.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
plural-exp.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
plural-exp.h Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
plural.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
plural.y Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
po2test.awk Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
textdomain.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
translit.po Update. 2000-11-02 07:51:38 +00:00
tst-codeset.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
tst-gettext2.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
tst-gettext2.sh Add --enable-hardcoded-path-in-tests configure option 2013-01-11 07:14:18 -08:00
tst-gettext3.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
tst-gettext4-de.po * sysdeps/i386/i686/memcmp.S: Move misplaced END. 2005-04-28 18:21:03 +00:00
tst-gettext4-fr.po * sysdeps/i386/i686/memcmp.S: Move misplaced END. 2005-04-28 18:21:03 +00:00
tst-gettext4.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
tst-gettext4.sh Add --enable-hardcoded-path-in-tests configure option 2013-01-11 07:14:18 -08:00
tst-gettext5.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
tst-gettext6.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
tst-gettext6.sh Add --enable-hardcoded-path-in-tests configure option 2013-01-11 07:14:18 -08:00
tst-gettext.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
tst-gettext.sh Add --enable-hardcoded-path-in-tests configure option 2013-01-11 07:14:18 -08:00
tst-ngettext.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
tst-translit.c Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
tst-translit.sh Add --enable-hardcoded-path-in-tests configure option 2013-01-11 07:14:18 -08:00
tstcodeset.po Update. 2001-04-10 00:15:08 +00:00
tstlang1.po Update. 2000-10-31 03:10:13 +00:00
tstlang2.po Update. 2000-10-31 03:10:13 +00:00
Versions Update. 2002-05-01 17:09:58 +00:00