This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug java/23617] New: Out of memory when classpath contains jar file with zip-style comment
- From: "wmahan at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Aug 2005 04:50:28 -0000
- Subject: [Bug java/23617] New: Out of memory when classpath contains jar file with zip-style comment
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
When trying to compile a file with Debian's gcj 4.0.1-2, I got an error like this:
HelloWorld.java:0: error: malformed .zip archive in CLASSPATH:
/usr/lib/j2re1.5-sun/lib/ext/localedata.jar/
jc1: out of memory allocating 1342179073 bytes after a total of 389120 bytes
It turns out the .jar file the error mentions has a zipfile comment. (JAR is
based on the zip format, which allows an variable-length comment at the end of
the file.) The compilation was successful when I removed the jar file from the
classpath.
Here's a simple test case to summarize: with gcj 4.0.1, the Info-ZIP utility,
and any class, say HelloWorld.java:
$ jar -cf test.jar; gcj -classpath test.jar HelloWorld.java # works fine
$ jar -cf test.jar; echo "some comment" | zip -z test.jar; gcj -classpath
test.jar HelloWorld.java
enter new zip file comment (end with .):
jc1: out of memory allocating 1663067502 bytes after a total of 135168 bytes
This problem is similar to bug 13020 for FastJar. I came up with a similar
solution: modifying zextract.c to check for a zipfile comment, and if necessary
scan backwards for the end-central-header signature. Unfortunately I haven't had
a chance to test the change compiled into gcc, although it appears to work in a
small test program.
--
Summary: Out of memory when classpath contains jar file with zip-
style comment
Product: gcc
Version: 4.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: wmahan at gmail dot com
CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23617