JDK-6466989 : Unsafe implementation of ImageIO.read()
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_10
  • CPU: sparc
  • Submitted: 2006-09-04
  • Updated: 2011-01-19
  • Resolved: 2006-09-04
Related Reports
Duplicate :  
Description
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.

Comments
EVALUATION Described problem was fixed as part of fix for 6336804.
04-09-2006