Parsing of BMP with oversized dimensions may fail with memory exhaustion

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P4
    • tbd
    • Affects Version/s: 8, 11, 17, 18, 19
    • Component/s: client-libs

      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

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

              Created:
              Updated:
              Resolved: