about summary refs log tree commit diff
path: root/ChangeLog
diff options
context:
space:
mode:
authorCarlos O'Donell <carlos@redhat.com>2013-05-22 14:50:26 -0400
committerCarlos O'Donell <carlos@redhat.com>2013-05-22 14:50:26 -0400
commit7a44c18fb4b1a65ebb1fece0b0d04f2570ed4d82 (patch)
treea6d12bc38f6df81be682c581c525653c883ed2f7 /ChangeLog
parentb50a71810bbd35b8c83ba6eff4e6cc6faf93a7ea (diff)
downloadglibc-7a44c18fb4b1a65ebb1fece0b0d04f2570ed4d82.tar.gz
glibc-7a44c18fb4b1a65ebb1fece0b0d04f2570ed4d82.tar.xz
glibc-7a44c18fb4b1a65ebb1fece0b0d04f2570ed4d82.zip
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 006dd86111c44572dbd3b26e9c63dd0f834d7762 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.
Diffstat (limited to 'ChangeLog')
-rw-r--r--ChangeLog10
1 files changed, 10 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 46a36cee01..49d3c366b6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+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  Joseph Myers  <joseph@codesourcery.com>
 
 	* math/gen-libm-test.pl (parse_args): Do not include expected