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

Parsing of BMP with oversized dimensions may fail with memory exhaustion

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P4
    • tbd
    • 8, 11, 17, 18, 19
    • client-libs

    Description

      A BMP file with oversized dimensions can fail during parsing in ImageIO.read() with memory exhaustion when creating the raster as input to the BufferedImage constructor [1].

      Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
      at java.desktop/java.awt.image.DataBufferByte.<init>(DataBufferByte.java:92)
      at java.desktop/java.awt.image.ComponentSampleModel.createDataBuffer(ComponentSampleModel.java:436)
      at java.desktop/java.awt.image.Raster.createWritableRaster(Raster.java:1122)
      at java.desktop/com.sun.imageio.plugins.bmp.BMPImageReader.read(BMPImageReader.java:910)
      at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1470)
      at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1365)
        

      [1] https://github.com/openjdk/jdk/blob/e96c599ed2a30ea116803aac0e85ba701ad40e25/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java#L910

      Attachments

        Activity

          People

            prr Philip Race
            mschoene Marc Schönefeld
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: