iconv dumps core on empty charmap

Bruno Haible bruno@clisp.org
Mon Apr 15 05:18:00 GMT 2002


iconv dumps core when trying to use an empty charmap file. Example:

/usr/bin/iconv -f /packages/glibc-20020408/localedata/charmaps/EMPTY -t /packages/glibc-20020408/localedata/charmaps/UTF-8 /packages/glibc-20020408/iconvdata/testdata/IBM856 > /dev/null
Segmentation fault (core dumped)

Here is a fix.


2002-04-14  Bruno Haible  <bruno@clisp.org>

	* locale/programs/charmap.c (charmap_read): Don't access result if
	result == NULL.

--- glibc-20020408/locale/programs/charmap.c.bak	2002-04-04 20:11:23.000000000 +0200
+++ glibc-20020408/locale/programs/charmap.c	2002-04-15 00:01:03.000000000 +0200
@@ -194,7 +194,7 @@
 default character map file `%s' not found"), DEFAULT_CHARMAP));
     }
 
-  if (result->code_set_name == NULL)
+  if (result != NULL && result->code_set_name == NULL)
     /* The input file does not specify a code set name.  This
        shouldn't happen but we should cope with it.  */
     result->code_set_name = basename (filename);



More information about the Libc-alpha mailing list