Mojira Archive
MC-122085

Generating server icon leaks encoded data buffer

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.

Fixed

Ben Staddon

2017-11-19, 08:20 AM

2018-04-16, 07:25 AM

2017-11-19, 09:24 AM

0

1

Confirmed

memory-leak

Minecraft 1.12.2

Minecraft 17w45b