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

PNG: reading metadata may cause OOM on truncated images.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 7
    • 7
    • client-libs
    • b54
    • generic
    • generic
    • Verified

        The loop that reads null terminated strings just looks for 0 being
        returned from ImageInputStream.read(). This ignores the possible value
        of -1 which would indicate an end of stream. Because of this, truncated
        PNG files could lead to long execution time (while the loop iterates at
        the end of the stream) followed by an OutOfMemoryError (when enough -1
        values have ben "read" and buffered).

        Test demonstrates this problem is attached.

              bae Andrew Brygin
              bae Andrew Brygin
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: