Piotr Karwasz created IMAGING-409:
-------------------------------------

             Summary: ICNS getImageInfo and getImageSize decode every image
                 Key: IMAGING-409
                 URL: https://issues.apache.org/jira/browse/IMAGING-409
             Project: Commons Imaging
          Issue Type: Bug
          Components: Format: ICNS
    Affects Versions: 1.0.0-alpha6
            Reporter: Piotr Karwasz


{{IcnsImageParser.getImageInfo}} and {{getImageSize}} call 
{{IcnsDecoder.decodeAllImages}}, which fully decodes every image element only 
to read their dimensions and count. For PNG/JPEG 2000 element types such as 
{{ic10}}, an empty or undecodable payload makes the decoder fall back to 
allocating a full-size ARGB image (1024 × 1024 for {{ic10}}). A file of about 
500 bytes with 64 empty {{ic10}} elements therefore makes 
{{Imaging.getImageInfo}} allocate 64 such images and fail with 
{{OutOfMemoryError}} on a small heap, although no pixel data is requested.

Suggested fix: derive the dimensions and image count from the element types 
({{IcnsType}}) in {{getImageInfo}} and {{getImageSize}} instead of decoding the 
images, and avoid allocating a placeholder image for an element that cannot be 
decoded.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to