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

Enforce limits on the size of an XBM image

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • 26
    • 8, 11, 17, 21, 24, 25, 26
    • client-libs
    • 2d
    • generic
    • generic

      XBM (X Bitmap) images are small one-bit deep images that were developed as a simple uncompressed format that could easily be included in C source files as include files.

      They are basically two #defines of width and height and a byte array with the bits.
      They were commonly used in X11 applications at a time when color graphics cards were not the norm.
      JDK's Toolkit Image API has always supported these, even thought it is not specified or even documented.
      The current implementation allows an arbitrarily large XBM which is not a valid use case for any XBM.
      Also it doesn't validate that the provided byte array is sufficient to populate the specified WxH.

      It is tempting to just delete the XBM support, but there's a small risk that some app actually depends on it.
      So instead we can just limit the size to something reasonable.
      XBMs would usually be something like 16x16 or 32x32, so maybe 128x128 pixels ? That's 16384 bytes.
      We could go larger if someone thinks it necessary.
      At the same time we can improve the overall implementation of this decoder.

            honkar Harshitha Onkar
            honkar Harshitha Onkar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: