Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6466989

Unsafe implementation of ImageIO.read()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0
    • client-libs

      FULL PRODUCT VERSION :


      ADDITIONAL OS VERSION INFORMATION :
      OS independent.

      A DESCRIPTION OF THE PROBLEM :
      The implementation of javax.imageio.ImageIO.read(ImageInputStream) and thus all those other methods that depend on it, may be unsafe (leak resources).

      The trailing stream.close() and reader.dispose() calls should be in nested finally clauses to ensure that resources are released even if an exception is thrown during the image read, eg from a corrupt image.


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Likely to cause OOM if busy application is forced to wait for finaliser to release resorces.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      Effectively inline all the code down to this and implement the nested finally clauses myself.

            bae Andrew Brygin
            igor Igor Nekrestyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: