From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32653 invoked by alias); 11 Oct 2007 23:06:14 -0000 Received: (qmail 32627 invoked by uid 22791); 11 Oct 2007 23:06:14 -0000 X-Spam-Check-By: sourceware.org Received: from sunsite.ms.mff.cuni.cz (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 11 Oct 2007 23:06:11 +0000 Received: from sunsite.mff.cuni.cz (localhost.localdomain [127.0.0.1]) by sunsite.mff.cuni.cz (8.13.8/8.13.8) with ESMTP id l9BN9BZe027038; Fri, 12 Oct 2007 01:09:11 +0200 Received: (from jakub@localhost) by sunsite.mff.cuni.cz (8.13.8/8.13.8/Submit) id l9BN9Bx5027031; Fri, 12 Oct 2007 01:09:11 +0200 Date: Thu, 11 Oct 2007 23:06:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] Fix collate_read Message-ID: <20071011230910.GJ2896@sunsite.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.2i Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2007-10/txt/msg00012.txt.bz2 Hi! WHen nowtok == tok_define && ignore_content, lr_ignore_rest only skips till end of line, but lr_token is not called, which means nowtok is never updated and we loop forever. The patch is large only because of identation changes. 2007-10-12 Jakub Jelinek * locale/programs/ld-collate.c (collate_read): If ignore_content and nowtok is tok_define, eat any tok_eol tokens. --- libc/locale/programs/ld-collate.c 2007-10-12 00:19:00.000000000 +0200 +++ libc/locale/programs/ld-collate.c 2007-10-12 00:59:35.000000000 +0200 @@ -2719,25 +2719,24 @@ collate_read (struct linereader *ldfile, while (nowtok == tok_define) { if (ignore_content) - { - lr_ignore_rest (ldfile, 0); - continue; - } - - arg = lr_token (ldfile, charmap, result, NULL, verbose); - if (arg->tok != tok_ident) - SYNTAX_ERROR (_("%s: syntax error"), "LC_COLLATE"); + lr_ignore_rest (ldfile, 0); else { - /* Simply add the new symbol. */ - struct name_list *newsym = xmalloc (sizeof (*newsym) - + arg->val.str.lenmb + 1); - memcpy (newsym->str, arg->val.str.startmb, arg->val.str.lenmb); - newsym->str[arg->val.str.lenmb] = '\0'; - newsym->next = defined; - defined = newsym; + arg = lr_token (ldfile, charmap, result, NULL, verbose); + if (arg->tok != tok_ident) + SYNTAX_ERROR (_("%s: syntax error"), "LC_COLLATE"); + else + { + /* Simply add the new symbol. */ + struct name_list *newsym = xmalloc (sizeof (*newsym) + + arg->val.str.lenmb + 1); + memcpy (newsym->str, arg->val.str.startmb, arg->val.str.lenmb); + newsym->str[arg->val.str.lenmb] = '\0'; + newsym->next = defined; + defined = newsym; - lr_ignore_rest (ldfile, 1); + lr_ignore_rest (ldfile, 1); + } } do Jakub