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

Image loading might fail for very small images

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • jfx23
    • javafx
    • None

      This came out of code review in the ImageStorage class:

          byte[] header = new byte[getMaxSignatureLength()];
          try {
              ImageTools.readFully(stream, header);
          } catch (EOFException ignored) {
              return null;
          }

      This code will take the largest possible signature length for known registered types (ie. JPG, GIF, BMP, PNG) and load those bytes. But if one of these formats could store a tiny image that would be smaller than the largest signature, then that image can't be loaded as this code would throw EOF and not return a suitable loader...

            jdv Jayathirth D V
            mstrauss Michael Strauß
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: