You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Bruno P. Kinoshita (Jira)" <ji...@apache.org> on 2022/08/14 01:53:00 UTC

[jira] [Commented] (IMAGING-332) OutOfMemory with invalid PNG input file

    [ https://issues.apache.org/jira/browse/IMAGING-332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17579301#comment-17579301 ] 

Bruno P. Kinoshita commented on IMAGING-332:
--------------------------------------------

Hi [~dominik.stadler@gmx.at] 

 

I just tested by adding a main method to Imaging with your code snippet:

 

!image-2022-08-14-13-50-28-786.png|width=581,height=327!

 

The code from the master branch is throwing an IOException. Did you get the OOM with alpha3? I had a look at the commits since 1.0-alpha3 release was cut, and they were mainly dependabot updates and some code clean-ups.

Leaving it open as the POI code looks really interesting. We could perhaps adapt it to Imaging and better handle allocating data. I'll see if I can review our code and the POI IOUtils code, and either use this ticket or create a new one to track it.

Thanks!

Bruno

 

> OutOfMemory with invalid PNG input file
> ---------------------------------------
>
>                 Key: IMAGING-332
>                 URL: https://issues.apache.org/jira/browse/IMAGING-332
>             Project: Commons Imaging
>          Issue Type: Bug
>          Components: Format: PNG
>    Affects Versions: 1.0-alpha3
>            Reporter: Dominik Stadler
>            Priority: Blocker
>              Labels: fuzzer
>         Attachments: image-2022-08-14-13-50-28-786.png
>
>
> The following snippet will cause an OOM as it tries to allocate a huge byte-array.
>  
> {code:java}
> byte[] input = java.util.Base64.getDecoder().decode("iVBORw0KGgoAAAAbaUNDUMlDQyCrbAAtGHZwQWdQyUNDIKtsAAAYiVBORw0KGgp1AAAASURBVA0KGgoAAAANSUhEUgAAACAAIAQACAJ/2QAAsnMAAAAAAElFTkRCYAAY");
> Imaging.getAllBufferedImages(input); {code}
> All such allocations should be guarded by some limits, see e.g. [https://poi.apache.org/apidocs/dev/org/apache/poi/util/IOUtils.html#safelyAllocate-long-int-] for how Apache POI supports a configurable limit for allocations.
>  



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