Handle invalid uuid int array

Closes #2475
This commit is contained in:
KennyTV 2021-05-15 16:42:38 +02:00
parent 54b0345017
commit 576682ef9f
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
2 changed files with 2 additions and 2 deletions

View File

@ -199,7 +199,7 @@ public class BukkitViaInjector implements ViaInjector {
@Override @Override
public int getServerProtocolVersion() throws Exception { public int getServerProtocolVersion() throws Exception {
if (PaperViaInjector.PAPER_PROTOCOL_METHOD) { if (PaperViaInjector.PAPER_PROTOCOL_METHOD) {
// *Trust me, it's safe* //noinspection deprecation
return Bukkit.getUnsafe().getProtocolVersion(); return Bukkit.getUnsafe().getProtocolVersion();
} }

View File

@ -209,7 +209,7 @@ public class InventoryPackets {
rewriteAttributeName(attribute, "AttributeName", true); rewriteAttributeName(attribute, "AttributeName", true);
rewriteAttributeName(attribute, "Name", true); rewriteAttributeName(attribute, "Name", true);
IntArrayTag uuidTag = attribute.get("UUID"); IntArrayTag uuidTag = attribute.get("UUID");
if (uuidTag != null) { if (uuidTag != null && uuidTag.getValue().length == 4) {
UUID uuid = UUIDIntArrayType.uuidFromIntArray(uuidTag.getValue()); UUID uuid = UUIDIntArrayType.uuidFromIntArray(uuidTag.getValue());
attribute.put("UUIDLeast", new LongTag(uuid.getLeastSignificantBits())); attribute.put("UUIDLeast", new LongTag(uuid.getLeastSignificantBits()));
attribute.put("UUIDMost", new LongTag(uuid.getMostSignificantBits())); attribute.put("UUIDMost", new LongTag(uuid.getMostSignificantBits()));