Uploaded image for project: 'Commons Imaging'
  1. Commons Imaging
  2. IMAGING-332

OutOfMemory with invalid PNG input file

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.0-alpha3
    • 1.0.0-alpha4
    • Format: PNG

    Description

      The following snippet will cause an OOM as it tries to allocate a huge byte-array.

       

      byte[] input = java.util.Base64.getDecoder().decode("iVBORw0KGgoAAAAbaUNDUMlDQyCrbAAtGHZwQWdQyUNDIKtsAAAYiVBORw0KGgp1AAAASURBVA0KGgoAAAANSUhEUgAAACAAIAQACAJ/2QAAsnMAAAAAAElFTkRCYAAY");
      Imaging.getAllBufferedImages(input); 

      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.

       

      Attachments

        1. image-2022-08-14-13-50-28-786.png
          248 kB
          Bruno P. Kinoshita

        Activity

          People

            Unassigned Unassigned
            dominik.stadler@gmx.at Dominik Stadler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: