Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-122085

Generating server icon leaks encoded data buffer

XMLWordPrintable

    • Confirmed

      See the function MinecraftServer#applyServerIconToResponse, in particular this section:

      ByteBuf bytebuf = Unpooled.buffer();
      
      try
      {
      	BufferedImage bufferedimage = ImageIO.read(file1);
      	Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide");
      	Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high");
      	ImageIO.write(bufferedimage, "PNG", new ByteBufOutputStream(bytebuf));
      	ByteBuf bytebuf1 = Base64.encode(bytebuf);
      	response.setFavicon("data:image/png;base64," + bytebuf1.toString(StandardCharsets.UTF_8));
      }
      catch (Exception exception)
      {
      	LOGGER.error("Couldn't load server icon", (Throwable)exception);
      }
      finally
      {
      	bytebuf.release();
      }
      

      While the original bytebuf is released, bytebuf1 is not.

            Unassigned Unassigned
            quadraxis Ben Staddon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: