From: Jakub Jelinek <jakub@redhat.com>
To: Andreas Schwab <schwab@suse.de>
Cc: libc-hacker@sources.redhat.com
Subject: Re: Bad alignment in locale-archive
Date: Tue, 22 Oct 2002 07:29:00 -0000 [thread overview]
Message-ID: <20021022162529.Z3451@sunsite.ms.mff.cuni.cz> (raw)
In-Reply-To: <jeznt7j2j0.fsf@sykes.suse.de>; from schwab@suse.de on Mon, Oct 21, 2002 at 04:21:39PM +0200
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 <jakub@redhat.com>
* locale/programs/locarchive.c (enlarge_archive): Make sure
string_size is always multiple of 4.
Reported by Andreas Schwab <schwab@suse.de>.
--- 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
next prev parent reply other threads:[~2002-10-22 14:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-22 7:00 Andreas Schwab
2002-10-22 7:29 ` Jakub Jelinek [this message]
2002-10-22 9:08 ` Roland McGrath
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=20021022162529.Z3451@sunsite.ms.mff.cuni.cz \
--to=jakub@redhat.com \
--cc=libc-hacker@sources.redhat.com \
--cc=schwab@suse.de \
/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).