bug-gnu-utils
[Top][All Lists]
Advanced

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

gettext 0.14.1 fails format-java-1 and format-java-2 tests due to bad fr


From: Richard Lloyd
Subject: gettext 0.14.1 fails format-java-1 and format-java-2 tests due to bad freeing of pointer
Date: Sat, 18 Sep 2004 23:37:43 +0100 (BST)

On an HP-UX 11.11 PA-RISC platform using gcc 3.4.2, gettext 0.14.1 fails
"gmake check" with the format-java-1 and format-java-2 tests due to an
incorrect pointer passed to freesa() in gettext-tools/src/format-java.c.

If you look at the message_format_parse() routine, you'll see that
there is a variable defined as "char *element;" (line 168) which is
allocated memory via xallocsa() (line 197). However, there are many places
in the code that follow of this form:

element++;   (or some other change to element)
...some code...
freesa (element);

This causes a core dump in HP-UX 11.11 of course, since you are trying
to free with the wrong pointer. What I would suggest is something like
adding another pointer copy called element_original thus (line 168 again):

        char *element,*element_original;

Then straight after the xallocsa() call in line 197:

        element_original=element;

Then, finally, modify all occurrences of freesa (element); to
freesa (element_original); elsewhere in the function.

When I do these fixes, "gmake check" works correctly with the format-java-1
and format-java-2 tests. I hope you can roll something like these fixes
into the next gettext release, so that the test suite works correctly on
more platforms (I'd be surprised if HP-UX was the only platform to see
this crash).

Apologies if this has already been fixed in CVS...

Richard K. Lloyd,           E-mail: address@hidden
Connect Internet Solutions,    WWW: http://www.connectinternetsolutions.com/
3, Brownlow Street,
Liverpool,
Merseyside, UK. L69 3GL




reply via email to

[Prev in Thread] Current Thread [Next in Thread]