You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2022/10/04 11:03:00 UTC

[jira] [Resolved] (COMPRESS-628) OutOfMemoryError on pack200 NewAttributeBands.readNextUnionCase

     [ https://issues.apache.org/jira/browse/COMPRESS-628?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory resolved COMPRESS-628.
--------------------------------------
    Fix Version/s: 1.22
       Resolution: Fixed

[~infandrew] 

Thank you for your report.

Fixed in git master and snapshot builds in https://repository.apache.org/content/repositories/snapshots/.

Please test and close.

> OutOfMemoryError on pack200 NewAttributeBands.readNextUnionCase
> ---------------------------------------------------------------
>
>                 Key: COMPRESS-628
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-628
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Archivers
>    Affects Versions: 1.21
>         Environment: ubuntu18, java-11-openjdk-amd64
>            Reporter: Andrii Hudz
>            Priority: Major
>             Fix For: 1.22
>
>
> Similar to https://issues.apache.org/jira/browse/COMPRESS-626
> pack200.NewAttributeBands.readNextUnionCase can result in an infinite loop that finally leads to an out of memory error.
> {code:java}
> import org.apache.commons.compress.harmony.pack200.*;
> public class ApacheCompress_1_22_90a4d8b3_OutOfMemory {
>     public static void main(String[] args) throws Exception {
>         CPUTF8 name = new CPUTF8("");
>         CPUTF8 layout = new CPUTF8("Re\\T");
>         new NewAttributeBands(1, null, null,
>                 new AttributeDefinitionBands.AttributeDefinition(35, AttributeDefinitionBands.CONTEXT_CLASS, name, layout)
>         );
>     }
> }
>  {code}
>  
> exception on 1.22 snapshot commit(90a4d8b3)
> {code:java}
> Exception in thread "main" java.lang.OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects {code}
> exception on  1.21
> {code:java}
> java.lang.OutOfMemoryError: Java heap space
>         at java.base/java.util.Arrays.copyOf(Arrays.java:3745)
>         at java.base/java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:172)
>         at java.base/java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:748)
>         at java.base/java.lang.StringBuffer.append(StringBuffer.java:429)
>         at org.apache.commons.compress.harmony.pack200.NewAttributeBands.getStreamUpToMatchingBracket(NewAttributeBands.java:822)
>         at org.apache.commons.compress.harmony.pack200.NewAttributeBands.readNextUnionCase(NewAttributeBands.java:304)
>         at org.apache.commons.compress.harmony.pack200.NewAttributeBands.readNextLayoutElement(NewAttributeBands.java:237)
>         at org.apache.commons.compress.harmony.pack200.NewAttributeBands.readNextAttributeElement(NewAttributeBands.java:184)
>         at org.apache.commons.compress.harmony.pack200.NewAttributeBands.parseLayout(NewAttributeBands.java:95)
>         at org.apache.commons.compress.harmony.pack200.NewAttributeBands.<init>(NewAttributeBands.java:53)
>         at ApacheCompress_1_22_90a4d8b3_OutOfMemory.main(ApacheCompress_1_22_90a4d8b3_OutOfMemory.java:7) {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)