mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Fix regex mistake in CB NBT int deserialization
The existing regex is too open and allows for the absence of any actual number data, detecting an NBT entry of just the letter "i" in upper or lower case. This causes a single-character NBT entry to be processed as an integer ending in "i", passing an empty String to to Integer.parseInt, triggering an exception in loading the item. This commit forces numbers to be present prior to the ending "i" letter.
This commit is contained in:
parent
07d11145d9
commit
0a7b472bee
@ -18,7 +18,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class CraftNBTTagConfigSerializer {
|
||||
|
||||
private static final Pattern ARRAY = Pattern.compile("^\\[.*]");
|
||||
private static final Pattern INTEGER = Pattern.compile("[-+]?(?:0|[1-9][0-9]*)?i", Pattern.CASE_INSENSITIVE);
|
||||
private static final Pattern INTEGER = Pattern.compile("[-+]?(?:0|[1-9][0-9]*)i", Pattern.CASE_INSENSITIVE); // Paper - fix regex
|
||||
private static final Pattern DOUBLE = Pattern.compile("[-+]?(?:[0-9]+[.]?|[0-9]*[.][0-9]+)(?:e[-+]?[0-9]+)?d", Pattern.CASE_INSENSITIVE);
|
||||
private static final TagParser MOJANGSON_PARSER = new TagParser(new StringReader(""));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user