From d557ca2dfba5ffcca99ceb41b07d149f871964b5 Mon Sep 17 00:00:00 2001 From: Loki Rautio Date: Mon, 9 Mar 2026 04:45:14 -0500 Subject: LCEMP RCE fixes Based on commit d017bfc30a68888bf5c79b23cf5c4f607cf828bf --- Minecraft.World/ByteArrayInputStream.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'Minecraft.World/ByteArrayInputStream.cpp') diff --git a/Minecraft.World/ByteArrayInputStream.cpp b/Minecraft.World/ByteArrayInputStream.cpp index d79eff36..9509206d 100644 --- a/Minecraft.World/ByteArrayInputStream.cpp +++ b/Minecraft.World/ByteArrayInputStream.cpp @@ -10,8 +10,19 @@ //offset - the offset in the buffer of the first byte to read. //length - the maximum number of bytes to read from the buffer. ByteArrayInputStream::ByteArrayInputStream(byteArray buf, unsigned int offset, unsigned int length) - : pos( offset ), count( min( offset+length, buf.length ) ), mark( offset ) + : pos(offset), mark(offset) { + if (offset > buf.length) + { + count = buf.length; + } + else if (length > buf.length - offset) + { + count = buf.length; + } + else + { + count = offset + length; this->buf = buf; } -- cgit v1.2.3