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

PNGImageReader does not consume the full image input stream

    XMLWordPrintable

Details

    Description

      FULL PRODUCT VERSION :
      java version "1.8.0_161"
      Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
      Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      System Version: macOS 10.12.6 (16G1212)
      Kernel Version: Darwin 16.7.0

      A DESCRIPTION OF THE PROBLEM :
      I am not sure this is a bug or working as designed.

      When using ImageIO.read(inputStream) where inputStream corresponds to a PNG image,
       it seems the 16 last bytes of the stream are not consumed (the IEND of the PNG is part of those bytes).

      The actual decoding does not seem affected (the PNG is properly decoded).
      The type of the input stream does not matter (checked with a couple of different implementations).

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Load a PNG file as an input stream, read it with ImageIO.read(.) and check if the end of the stream has been reached.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Should the input stream be expected to be consumed until EOF?
      ACTUAL -
      The last 16 bytes of the input stream are not read.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      SUPPORT :
      YES

      Attachments

        Activity

          People

            jdv Jayathirth D V
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: