public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Further protection of localedef against bogus input
@ 2006-08-28 13:47 Jakub Jelinek
  2006-08-28 16:17 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2006-08-28 13:47 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Glibc hackers

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Further protection of localedef against bogus input
  2006-08-28 13:47 [PATCH] Further protection of localedef against bogus input Jakub Jelinek
@ 2006-08-28 16:17 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2006-08-28 16:17 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Glibc hackers

[-- Attachment #1: Type: text/plain, Size: 101 bytes --]

Applied.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 251 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-08-28 16:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-28 13:47 [PATCH] Further protection of localedef against bogus input Jakub Jelinek
2006-08-28 16:17 ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).