[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patches] [PATCH] localedef cross endianess problem



Marc Kleine-Budde wrote:
Hello,

we're using the stand alone locale def program quite happily, but we
noticed a segfault when trying to generate a locale archive for a
different endianess (i.e. x64 -> ppc).

please keep me on CC, I'm not subscribed.

cheers, Marc

---

From: Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx>
Subject: fix cross endianess segfault

This patch fixes a segfault that occurs if the generated locale
archive endianess does not equal the hosts endianess.

Without this patch the offset in filedata->strindex is in the
wrong endianess which means a quite big offset pointing beyond
the allocated data, which causes the later strlen to segfault.
This patch swaps the offset to the correct endianess.

Marc,

Thank you for the patch.  I have a couple of comments on it though:

1. The problem does not seem to be specific to EGLIBC, the bug is in generic GLIBC code, so the best place to fix it is, probably, directly in FSF GLIBC. We try not to deviate from FSF GLIBC when unnecessary.

2. I am in the process of looking at the localedef code and do not yet have a firm understanding of how the data flows; my current understanding, though, is that you're patching up /one/ of the placed where access to ->strindex is made, what about the others? See, for example, locale.c.

3. Also, wouldn't it be easier to covert the data to correct endianess at the point of writing instead of the point of reading it? For what it worth, I haven't yet figured out where the write does occur, so can easily be wrong on this count.

Thank you,

--
Maxim K.
CodeSourcery