diff options
| author | Loki Rautio <lokirautio@gmail.com> | 2026-03-09 04:45:14 -0500 |
|---|---|---|
| committer | Loki Rautio <lokirautio@gmail.com> | 2026-03-09 04:45:14 -0500 |
| commit | d557ca2dfba5ffcca99ceb41b07d149f871964b5 (patch) | |
| tree | 89ef5bd5fdb2a86fe10a5dead65b65bce8aa0a1d /Minecraft.World/ByteArrayInputStream.cpp | |
| parent | 0c4f4599045edad935403e4d79d28f6b9aa95833 (diff) | |
LCEMP RCE fixes
Based on commit d017bfc30a68888bf5c79b23cf5c4f607cf828bf
Diffstat (limited to 'Minecraft.World/ByteArrayInputStream.cpp')
| -rw-r--r-- | Minecraft.World/ByteArrayInputStream.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
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; } |
