Patch: out of memory error when reading jar files with zip comments

Wil Mahan wmahan@gmail.com
Mon Aug 29 06:00:00 GMT 2005


Hi,

When gcj's CLASSPATH contains a .jar file with a zip-style comment, I
get an error like this:

jc1: out of memory allocating 1663067502 bytes after a total of 135168 bytes

A test case is:

jar -cf test.jar   # create an empty jar file
echo "some comment" | zip -z test.jar  # add a zip comment
gcj -classpath test.jar Foo.java   # fails with above message

The problem is that the code for reading .jar files (which are really
special .zip files) does not handle zip-style comments. I just
submitted PR java/23617 regarding this issue. Attached is my attempt to
fix it by scanning back through the comment from the end, until the
end-central-header section is reached.

Thanks,
Wil

2005-08-29  Wil Mahan  <wmahan@gmail.com>
	PR java/23617
	* zextract.c (read_zip_archive): Fix out of memory error when
	reading jar files with zip-style comments.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zipcomment.patch
Type: text/x-patch
Size: 1260 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20050829/8d096763/attachment.bin>


More information about the Java-patches mailing list