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

Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.97
    • 1.0-alpha1
    • None
    • None
    • Windows, Unix
      Sun Java JVM (multiple versions)

    Description

      In order to extract JPEG image dimensions, Apache Commons Sanselan (0.97) was used as follows:

      File imgfile = new File("./test.jpg");
      org.apache.sanselan.Sanselan.getImageInfo(imgfile);

      For most JPEG images, this code works as expected. However with specific JPEG files, the call to getImageInfo() causes a repeatable java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException - depending upon the input JPEG file. The same files can be processed with javax.imageio.ImageReader without such issues.

      The OutOfMemoryError is especially serious as it may cause JVM to fail.

      Attachments

        1. NegativeArraySizeException.jpg
          83 kB
          Dominic Early
        2. OutOfMemoryError.jpg
          87 kB
          Dominic Early
        3. SanselanTest.java
          3 kB
          Dominic Early
        4. SanselanTest.java
          3 kB
          Dominic Early

        Activity

          People

            Unassigned Unassigned
            dominic.early@mitchell.com Dominic Early
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: