Bug#745815: libjarjar-java: generate jars with invalid information

Miguel Landaeta nomadium at debian.org
Fri Apr 25 13:37:03 UTC 2014


Package: libjarjar-java
Version: 1.4+svn142-1
Severity: important

groovy package generates two jar files during build time and one of
them (groovy-all.jar) is manipulated with libjarjar-java during its
creation.

This worked OK until 1.1-3 but stopped working on 1.4+svn142-1 with
the inclusion of libasm4-java among libjarjar-java dependencies.

Example:

miguel at nina:~/packages/groovy$ groovy -cp "/usr/share/java/groovy-all-1.8.6.jar" -e 'println 1'
java.lang.OutOfMemoryError: Java heap space
        at java.util.ArrayList.<init>(ArrayList.java:144)
        at org.codehaus.groovy.reflection.GeneratedMetaMethod$DgmMethodRecord.loadDgmInfo(GeneratedMetaMethod.java:193)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerMethods(MetaClassRegistryImpl.java:155)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:83)
        at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:61)
        at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:29)
        at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:49)
        at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:32)
        at groovy.lang.Binding.<init>(Binding.java:34)
        at groovy.lang.GroovyShell.<init>(GroovyShell.java:70)
        at groovy.ui.GroovyMain.processOnce(GroovyMain.java:544)
        at groovy.ui.GroovyMain.run(GroovyMain.java:337)
        at groovy.ui.GroovyMain.process(GroovyMain.java:323)
        at groovy.ui.GroovyMain.processArgs(GroovyMain.java:120)
        at groovy.ui.GroovyMain.main(GroovyMain.java:100)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:108)
        at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:130)
1


I also took a look at groovy source code on that file GeneratedMetaMethod.java
at line 193 and I found this call:

List<DgmMethodRecord> res = new ArrayList<DgmMethodRecord>(size);

On normal circumstances 'size' variable contains the size of dgminfo
(jar:file:/usr/share/java//groovy-all-1.8.6.jar!/META-INF/dgminfo)
contained on the groovy jar file and we are talking about 1072
elements. However when groovy-all.jar is generated with recent
libjarjar-java versions, the .jar contains invalid information and
'size' variable ends with an insanely high value, ending with a memory
error and triggering the described error, e.g.:

List<DgmMethodRecord> res = new ArrayList<DgmMethodRecord>(570428522);

If I find more information I'll post it here, in the meantime, as
workaround I had to avoid any usage on groovy-all.jar if possible.

-- System Information:
Debian Release: 7.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.13-0.bpo.1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash

-- 
Miguel Landaeta, nomadium at debian.org
secure email with PGP 0x6E608B637D8967E9 available at
http://db.debian.org/fetchkey.cgi?fingerprint=4CB7FE1E280ECC90F29A597E6E608B637D8967E9
"Faith means not wanting to know what is true." -- Nietzsche
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-java-maintainers/attachments/20140425/84ba369a/attachment.sig>


More information about the pkg-java-maintainers mailing list