Scissors/patches/server/0042-Fix-component-extra-empty-array-exploit.patch
Luna 65d7993679
Backport 1.20.1 patches to 1.19.4 (#116)
* First pass

* Second and final pass

* Update Jenkinsfile
2023-07-04 16:10:53 -05:00

19 lines
1.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Luna <lunahatesgogle@gmail.com>
Date: Mon, 29 May 2023 19:34:50 -0300
Subject: [PATCH] Fix component extra empty array exploit
diff --git a/src/main/java/net/minecraft/network/chat/Component.java b/src/main/java/net/minecraft/network/chat/Component.java
index 2873ed7c443ed8c8c57a8b1d3e444d229f10f07b..a2149452ee461002ea74189c5aa49cddd943d0cf 100644
--- a/src/main/java/net/minecraft/network/chat/Component.java
+++ b/src/main/java/net/minecraft/network/chat/Component.java
@@ -266,6 +266,7 @@ public interface Component extends Message, FormattedText, Iterable<Component> {
if (!jsonelement.isJsonObject()) {
if (jsonelement.isJsonArray()) {
JsonArray jsonarray = jsonelement.getAsJsonArray();
+ if (jsonarray.size() <= 0) throw new JsonParseException("Unexpected empty array of components"); // Scissors
ichatmutablecomponent = null;
Iterator iterator = jsonarray.iterator();