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

Throw proper exception when CRC length is not proper for IEND chunk

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P5 P5
    • tbd
    • 10, 11, 12
    • client-libs
    • None

      If we run test case present in JDK-8211422 it throws IIOException:
      Exception in thread "main" javax.imageio.IIOException: Error reading PNG metadata
      at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.readMetadata(PNGImageReader.java:891)
      at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1395)
      at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1810)
      at ImageIObug.main(ImageIObug.java:22)
      Caused by: javax.imageio.IIOException: Invalid chunk length 0
      at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.readMetadata(PNGImageReader.java:765)
      ... 3 more

      This is happening because CRC for IEND chunk is not of length 4. Instead of just throwing an exception saying "Invalid chunk length 0" we should also say that CRC is not of length 4. chunk length 0 is valid for IEND chunk.

            jdv Jayathirth D V
            jdv Jayathirth D V
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: