You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Dominic Early (JIRA)" <ji...@apache.org> on 2011/06/30 09:34:28 UTC

[jira] [Created] (SANSELAN-53) Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException

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

                 Key: SANSELAN-53
                 URL: https://issues.apache.org/jira/browse/SANSELAN-53
             Project: Commons Sanselan
          Issue Type: Bug
    Affects Versions: 0.94-incubator
         Environment: Windows, Unix
Sun Java JVM (multiple versions)
            Reporter: Dominic Early


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.



--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SANSELAN-53) Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException

Posted by "Dominic Early (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANSELAN-53?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13058042#comment-13058042 ] 

Dominic Early commented on SANSELAN-53:
---------------------------------------

Below is the output from running the attached SanselanTest.java application with the two attached .JPG files.  Observe that javax.imageio libraries are able to return the correct dimensions but the Sanselan calls result in a throwable:



Processsing file [NegativeArraySizeException.jpg]
javax.imageio Dimensions: {width=640.0,height=480.0}
Throwable occurred while processing file [NegativeArraySizeException.jpg]
java.lang.NegativeArraySizeException
	at org.apache.sanselan.formats.tiff.fieldtypes.FieldType.getRawBytes(FieldType.java:77)
	at org.apache.sanselan.formats.tiff.fieldtypes.FieldTypeUnknown.getSimpleValue(FieldTypeUnknown.java:42)
	at org.apache.sanselan.formats.tiff.constants.TagInfo.getValue(TagInfo.java:98)
	at org.apache.sanselan.formats.tiff.constants.TagInfo$Unknown.getValue(TagInfo.java:443)
	at org.apache.sanselan.formats.tiff.TiffField.getValue(TiffField.java:577)
	at org.apache.sanselan.formats.tiff.TiffField.getValueDescription(TiffField.java:317)
	at org.apache.sanselan.formats.tiff.TiffImageMetadata$Item.<init>(TiffImageMetadata.java:193)
	at org.apache.sanselan.formats.tiff.TiffImageMetadata$Directory.add(TiffImageMetadata.java:65)
	at org.apache.sanselan.formats.tiff.TiffImageParser.getMetadata(TiffImageParser.java:143)
	at org.apache.sanselan.ImageParser.getMetadata(ImageParser.java:81)
	at org.apache.sanselan.formats.jpeg.JpegImageParser.getExifMetadata(JpegImageParser.java:366)
	at org.apache.sanselan.formats.jpeg.JpegImageParser.getMetadata(JpegImageParser.java:307)
	at org.apache.sanselan.formats.jpeg.JpegImageParser.getImageInfo(JpegImageParser.java:729)
	at org.apache.sanselan.Sanselan.getImageInfo(Sanselan.java:589)
	at org.apache.sanselan.Sanselan.getImageInfo(Sanselan.java:563)
	at org.apache.sanselan.Sanselan.getImageInfo(Sanselan.java:582)
	at SanselanTest.main(SanselanTest.java:67)
Processsing file [OutOfMemoryError.jpg]
javax.imageio Dimensions: {width=640.0,height=480.0}
Throwable occurred while processing file [OutOfMemoryError.jpg]
java.lang.OutOfMemoryError: Java heap space

> Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SANSELAN-53
>                 URL: https://issues.apache.org/jira/browse/SANSELAN-53
>             Project: Commons Sanselan
>          Issue Type: Bug
>    Affects Versions: 0.94-incubator
>         Environment: Windows, Unix
> Sun Java JVM (multiple versions)
>            Reporter: Dominic Early
>         Attachments: NegativeArraySizeException.jpg, OutOfMemoryError.jpg, SanselanTest.java, SanselanTest.java
>
>
> 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SANSELAN-53) Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException

Posted by "Damjan Jovanovic (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANSELAN-53?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13057654#comment-13057654 ] 

Damjan Jovanovic commented on SANSELAN-53:
------------------------------------------

Can you please attach a JPEG that causes this?


> Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SANSELAN-53
>                 URL: https://issues.apache.org/jira/browse/SANSELAN-53
>             Project: Commons Sanselan
>          Issue Type: Bug
>    Affects Versions: 0.94-incubator
>         Environment: Windows, Unix
> Sun Java JVM (multiple versions)
>            Reporter: Dominic Early
>
> 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (SANSELAN-53) Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException

Posted by "Dominic Early (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANSELAN-53?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dominic Early updated SANSELAN-53:
----------------------------------

    Attachment: OutOfMemoryError.jpg

Example JPEG file that causes OutOfMemoryError when parsed by Apache Sanselan

> Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SANSELAN-53
>                 URL: https://issues.apache.org/jira/browse/SANSELAN-53
>             Project: Commons Sanselan
>          Issue Type: Bug
>    Affects Versions: 0.94-incubator
>         Environment: Windows, Unix
> Sun Java JVM (multiple versions)
>            Reporter: Dominic Early
>         Attachments: NegativeArraySizeException.jpg, OutOfMemoryError.jpg, SanselanTest.java
>
>
> 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (SANSELAN-53) Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException

Posted by "Dominic Early (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANSELAN-53?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dominic Early updated SANSELAN-53:
----------------------------------

    Attachment: SanselanTest.java

Test driver demonstrates how the two sample files are parsed by javax.imageio without issue, but cause NegativeArraySizeException or OutOfMemoryError when parsed by Apache Sanselan 

> Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SANSELAN-53
>                 URL: https://issues.apache.org/jira/browse/SANSELAN-53
>             Project: Commons Sanselan
>          Issue Type: Bug
>    Affects Versions: 0.94-incubator
>         Environment: Windows, Unix
> Sun Java JVM (multiple versions)
>            Reporter: Dominic Early
>         Attachments: SanselanTest.java
>
>
> 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (SANSELAN-53) Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException

Posted by "Emmanuel Bourg (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANSELAN-53?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Bourg updated SANSELAN-53:
-----------------------------------

    Affects Version/s:     (was: 0.94-incubator)
                       0.97
        Fix Version/s: 1.0
    
> Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SANSELAN-53
>                 URL: https://issues.apache.org/jira/browse/SANSELAN-53
>             Project: Commons Sanselan
>          Issue Type: Bug
>    Affects Versions: 0.97
>         Environment: Windows, Unix
> Sun Java JVM (multiple versions)
>            Reporter: Dominic Early
>             Fix For: 1.0
>
>         Attachments: NegativeArraySizeException.jpg, OutOfMemoryError.jpg, SanselanTest.java, SanselanTest.java
>
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (SANSELAN-53) Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException

Posted by "Dominic Early (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANSELAN-53?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dominic Early updated SANSELAN-53:
----------------------------------

    Attachment: SanselanTest.java

Test driver demonstrates how the two sample files are parsed by javax.imageio without issue, but cause NegativeArraySizeException or OutOfMemoryError when parsed by Apache Sanselan 

(minor update)

> Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SANSELAN-53
>                 URL: https://issues.apache.org/jira/browse/SANSELAN-53
>             Project: Commons Sanselan
>          Issue Type: Bug
>    Affects Versions: 0.94-incubator
>         Environment: Windows, Unix
> Sun Java JVM (multiple versions)
>            Reporter: Dominic Early
>         Attachments: NegativeArraySizeException.jpg, OutOfMemoryError.jpg, SanselanTest.java, SanselanTest.java
>
>
> 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (SANSELAN-53) Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException

Posted by "Damjan Jovanovic (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANSELAN-53?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Damjan Jovanovic resolved SANSELAN-53.
--------------------------------------

    Resolution: Fixed

I've worked around even NegativeArraySizeException in commit 1209945. Resolving fixed.
                
> Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SANSELAN-53
>                 URL: https://issues.apache.org/jira/browse/SANSELAN-53
>             Project: Commons Sanselan
>          Issue Type: Bug
>    Affects Versions: 0.94-incubator
>         Environment: Windows, Unix
> Sun Java JVM (multiple versions)
>            Reporter: Dominic Early
>         Attachments: NegativeArraySizeException.jpg, OutOfMemoryError.jpg, SanselanTest.java, SanselanTest.java
>
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (SANSELAN-53) Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException

Posted by "Dominic Early (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANSELAN-53?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dominic Early updated SANSELAN-53:
----------------------------------

    Attachment: NegativeArraySizeException.jpg

Example JPEG file that causes NegativeArraySizeException when parsed by Apache Sanselan

> Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SANSELAN-53
>                 URL: https://issues.apache.org/jira/browse/SANSELAN-53
>             Project: Commons Sanselan
>          Issue Type: Bug
>    Affects Versions: 0.94-incubator
>         Environment: Windows, Unix
> Sun Java JVM (multiple versions)
>            Reporter: Dominic Early
>         Attachments: NegativeArraySizeException.jpg, OutOfMemoryError.jpg, SanselanTest.java
>
>
> 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SANSELAN-53) Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException

Posted by "Damjan Jovanovic (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANSELAN-53?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13157421#comment-13157421 ] 

Damjan Jovanovic commented on SANSELAN-53:
------------------------------------------

The OutOfMemoryError is fixed in SVN HEAD by commit 1206412. The NegativeArraySizeException is a different problem.

                
> Bug in Sanselan.getImageInfo(File) with certain JPEGs causing java.lang.OutOfMemoryError or java.lang.NegativeArraySizeException
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SANSELAN-53
>                 URL: https://issues.apache.org/jira/browse/SANSELAN-53
>             Project: Commons Sanselan
>          Issue Type: Bug
>    Affects Versions: 0.94-incubator
>         Environment: Windows, Unix
> Sun Java JVM (multiple versions)
>            Reporter: Dominic Early
>         Attachments: NegativeArraySizeException.jpg, OutOfMemoryError.jpg, SanselanTest.java, SanselanTest.java
>
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira