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 2019/05/16 01:45:00 UTC

[jira] [Commented] (IMAGING-211) Imaging.getBufferedImage fails throwing java.lang.ArrayIndexOutOfBoundsException for specific inputs -- evintila-april_dynamics

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

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

One warning in exiftool when validating, regarding a PNG chunk size issue:
{noformat}
$ exiftool -v -validate testfile_2.png
  ExifToolVersion = 10.80
  FileName = testfile_2.png
  Directory = .
  FileSize = 35144
  FileModifyDate = 1557970557
  FileAccessDate = 1557970559
  FileInodeChangeDate = 1557970559
  FilePermissions = 33204
  FileType = PNG
  FileTypeExtension = PNG
  MIMEType = image/png
  Warning = Bad CRC for IHDR chunk
PNG IHDR (13 bytes):
  + [BinaryData directory, 13 bytes]
  | ImageWidth = 398
  | ImageHeight = 249
  | BitDepth = 8
  | ColorType = 6
  | Compression = 0
  | Filter = 157
  | Interlace = 157
  Warning = Invalid PNG chunk size
  Validate = 0 2 0
Validate                        : 2 Warnings{noformat}

> Imaging.getBufferedImage fails throwing java.lang.ArrayIndexOutOfBoundsException for specific inputs -- evintila-april_dynamics
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: IMAGING-211
>                 URL: https://issues.apache.org/jira/browse/IMAGING-211
>             Project: Commons Imaging
>          Issue Type: Bug
>          Components: imaging.common.*
>    Affects Versions: 1.0-alpha1
>         Environment: Ubuntu 17.10
>            Reporter: Emanuel Vintila
>            Assignee: Bruno P. Kinoshita
>            Priority: Major
>              Labels: patch, security
>         Attachments: testfile_2.png
>
>
> For specific inputs, Imaging.getBufferedImage fails throwing java.lang.ArrayIndexOutOfBoundsException: -99, instead of ImageReadException or IOException. 
>  Example code that can be used to reproduce the problem, with "testfile_2" found at this link [testfile_2|https://drive.google.com/open?id=1Hu4VOWEJ2ARqAmDDhb9zT5kEbi-Ukrct]:
> {code:java}
> // evintila @ April Dynamics
> File file = new File("testfile_2");
> final Map<String, Object> params = new HashMap<>();
> params.put(ImagingConstants.BUFFERED_IMAGE_FACTORY,
> new ManagedImageBufferedImageFactory());
> try
> { // the problem is here: 
>     final BufferedImage image = Imaging.getBufferedImage(file, params); }
> catch (ImageReadException e)
> {
> } catch (IOException e)
> {
> }{code}
> Output:
> {noformat}
> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -99
> at org.apache.commons.imaging.formats.png.chunks.PngChunkIhdr.<init>(PngChunkIhdr.java:55)
> at org.apache.commons.imaging.formats.png.PngImageParser.readChunks(PngImageParser.java:186)
> at org.apache.commons.imaging.formats.png.PngImageParser.readChunks(PngImageParser.java:229)
> at org.apache.commons.imaging.formats.png.PngImageParser.getBufferedImage(PngImageParser.java:494)
> at org.apache.commons.imaging.Imaging.getBufferedImage(Imaging.java:1377)
> at org.apache.commons.imaging.Imaging.getBufferedImage(Imaging.java:1365){noformat}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)