This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] charset: sanitize if empty


it looks like allowed but nl_langinfo(CODESET) returns "" on Darwin. Unfortunately GNU libiconv doesn't
like it at all and may enter into an infinite loop. I discovered this while running the gdb testsuite.
The bug was reported to GNU libiconv and fixed, but I think it doesn't hurt to sanitize more


2009-10-23 Tristan Gingold <>

	* charset.c (_initialize_charset): Set a default value to
	auto_host_charset_name if empty.

--- charset.c 25 Sep 2009 20:53:12 -0000 1.25
+++ charset.c 23 Oct 2009 13:26:01 -0000
@@ -818,8 +818,10 @@
auto_host_charset_name = nl_langinfo (CODESET);
/* Solaris will return `646' here -- but the Solaris iconv then
- does not accept this. */
- if (!strcmp (auto_host_charset_name, "646"))
+ does not accept this.
+ Darwin (and maybe FreeBSD) may return "" here, which GNU libiconv
+ doesn't like (infinite loop). */
+ if (!strcmp (auto_host_charset_name, "646") || ! *auto_host_charset_name)
auto_host_charset_name = "ASCII";
target_charset_name = auto_host_charset_name;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]