public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: [PATCH] Further protection of localedef against bogus input
Date: Mon, 28 Aug 2006 13:47:00 -0000	[thread overview]
Message-ID: <20060828134657.GM4556@sunsite.mff.cuni.cz> (raw)

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

             reply	other threads:[~2006-08-28 13:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-28 13:47 Jakub Jelinek [this message]
2006-08-28 16:17 ` Ulrich Drepper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060828134657.GM4556@sunsite.mff.cuni.cz \
    --to=jakub@redhat.com \
    --cc=drepper@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).