From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24599 invoked by alias); 22 Oct 2002 14:25:34 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 24560 invoked from network); 22 Oct 2002 14:25:33 -0000 Received: from unknown (HELO sunsite.mff.cuni.cz) (195.113.19.66) by sources.redhat.com with SMTP; 22 Oct 2002 14:25:33 -0000 Received: (from jakub@localhost) by sunsite.mff.cuni.cz (8.11.6/8.11.6) id g9MEPUD13985; Tue, 22 Oct 2002 16:25:30 +0200 Date: Tue, 22 Oct 2002 07:29:00 -0000 From: Jakub Jelinek To: Andreas Schwab Cc: libc-hacker@sources.redhat.com Subject: Re: Bad alignment in locale-archive Message-ID: <20021022162529.Z3451@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: ; from schwab@suse.de on Mon, Oct 21, 2002 at 04:21:39PM +0200 X-SW-Source: 2002-10/txt/msg00082.txt.bz2 On Mon, Oct 21, 2002 at 04:21:39PM +0200, Andreas Schwab wrote: > This fixes invalid alignments in the locale-archive file. I don't think we should use __alignof__, what if it is different among arches with the same endianity. locale-archive format should be only endianess dependent, not anything else. Furthermore, all but one alignment is unnecessary, and in that one case (enlarge_archive's newhead.locrectab_offset = newhead.string_offset + newhead.string_size; ) it is IMHO better to make sure string_size is always multiple of 4, like: 2002-10-22 Jakub Jelinek * locale/programs/locarchive.c (enlarge_archive): Make sure string_size is always multiple of 4. Reported by Andreas Schwab . --- libc/locale/programs/locarchive.c.jj 2002-10-22 15:34:37.000000000 +0200 +++ libc/locale/programs/locarchive.c 2002-10-22 16:32:38.000000000 +0200 @@ -272,7 +272,8 @@ enlarge_archive (struct locarhandle *ah, newhead.string_offset = (newhead.namehash_offset + (newhead.namehash_size * sizeof (struct namehashent))); - newhead.string_size = MAX (2 * newhead.string_used, newhead.string_size); + newhead.string_size = MAX ((2 * newhead.string_used + 3) & -4, + newhead.string_size); newhead.locrectab_offset = newhead.string_offset + newhead.string_size; newhead.locrectab_size = MAX (2 * newhead.locrectab_used, Jakub