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

TIFF reading fails when ignoring metadata with BaselineTIFFTagSet removed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: client-libs
    • Labels:

      Description

      The following code will fail with varying exceptions depending on the exact situation:

              ImageInputStream iis; // initialization assumed
              ImageReader reader =
                  ImageIO.getImageReadersByFormatName("TIFF").next();
              TIFFImageReadParam param = new TIFFImageReadParam();
              param.removeAllowedTagSet(BaselineTIFFTagSet.getInstance());
              reader.setInput(iis, false, true);
              BufferedImage image = reader.read(0, param); // fails here

      For example:

      Exception in thread "main" javax.imageio.IIOException: Insufficient data offsets or byte counts
      at com.sun.imageio.plugins.tiff.TIFFIFD.checkFieldOffsets(java.desktop/TIFFIFD.java:460)

      The BaselineTIFFTagSet contains some fields which are essential for reading the data and should never be ignored.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bpb Brian Burkhalter
              Reporter:
              bpb Brian Burkhalter
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: