crash on GCJ_PROPERTIES="foo=" program
Paul Bolle
pebolle@tiscali.nl
Sat Feb 26 16:05:00 GMT 2005
0) This is more of a bug report then a patch. (I do hope this is the
correct list to report it. Otherwise I'll gladly forward this message to
gcc-patches@gcc.gnu.org or somewhere else.)
1) I've been playing with gcj recently (as included in gcc-3.4.2, in the
version shipped with Fedora Core 3).
2) I noticed that programs compiled by gcj would segfault when given a
GCJ_PROPERTIES environment variable with an empty value, for example:
GCJ_PROPERTIES="foo=" program
3) Looking at the code of libjava/prims.cc I noticed next_property_value
doesn't seem to handle the length of an empty (zero length) value
correctly. In that case it seems to reuse the length of the key part of
that key/value pair. I guess that this might cause a crash (when null
terminating the key/value pairs later). Please find attached a (trivial)
patch, written on that idea.
4) However, I didn't manage to test this patch as recompiling etc. gcc
and friends ended in a "/usr/bin/ld: Argument list too long" (after
which I gave up my attempt at correcting this myself). But maybe someone
else might like to review my analysis and maybe even test my patch.
5) Well, at least you have a bug report now ...
Kind regards,
Paul Bolle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc34-gcj_properties.patch
Type: text/x-patch
Size: 242 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20050226/2c4febf7/attachment.bin>
More information about the Java-patches
mailing list