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

TIFF reading fails when ignoring metadata with BaselineTIFFTagSet removed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • 9
    • client-libs

    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

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

              Dates

                Created:
                Updated:
                Resolved: