This is the mail archive of the libc-hacker@sourceware.org mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

[PATCH] Further protection of localedef against bogus input


Hi!

ld-ctype.c test:
echo FOO=bar > translit_neutral
localedef -i en_US -f UTF-8 /tmp/en_US.UTF-8 -c

ld-collate.c test:
cat > en_HW <<EOF
LC_COLLATE
copy "iso14651_t1"
collating-symbol  <c-h-br>
collating-element <C-H> from "<U0043><U0048>"
END LC_COLLATE
EOF
for i in IDENTIFICATION CTYPE MONETARY NUMERIC TIME MESSAGES PAPER NAME \
	 ADDRESS TELEPHONE MEASUREMENT; do
  echo -e LC_$i'\ncopy "en_US"\nEND LC_'$i
done >> en_HW
echo FOO=bar > iso14651_t1
localedef -i en_HW -f UTF-8 /tmp/en_HW.UTF-8 -c

2006-08-28  Jakub Jelinek  <jakub@redhat.com>

	* locale/programs/ld-ctype.c (translit_flatten): Issue error
	if other's ctype category was missing.
	* locale/programs/ld-collate.c (collate_read): Return if
	copy_locale's collate category is missing.

--- libc/locale/programs/ld-ctype.c.jj	2006-08-28 13:20:38.000000000 +0200
+++ libc/locale/programs/ld-ctype.c	2006-08-28 15:12:52.000000000 +0200
@@ -3769,7 +3769,7 @@ translit_flatten (struct locale_ctype_t 
 
       other = find_locale (LC_CTYPE, copy_locale, copy_repertoire, charmap);
 
-      if (other == NULL)
+      if (other == NULL || other->categories[LC_CTYPE].ctype == NULL)
 	{
 	  WITH_CUR_LOCALE (error (0, 0, _("\
 %s: transliteration data from locale `%s' not available"),
--- libc/locale/programs/ld-collate.c.jj	2005-12-30 09:04:02.000000000 +0100
+++ libc/locale/programs/ld-collate.c	2006-08-28 15:35:27.000000000 +0200
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2002, 2003, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2002, 2003, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
 
@@ -2671,6 +2671,9 @@ collate_read (struct linereader *ldfile,
 	      if (locfile_read (copy_locale, charmap) != 0)
 		goto skip_category;
 	    }
+
+	  if (copy_locale->categories[LC_COLLATE].collate == NULL)
+	    return;
 	}
 
       lr_ignore_rest (ldfile, 1);

	Jakub


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