Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

[BUG] Crash from invalid regex #45

Open
Gjum opened this issue Jun 9, 2022 · 0 comments
Open

[BUG] Crash from invalid regex #45

Gjum opened this issue Jun 9, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Gjum
Copy link

Gjum commented Jun 9, 2022

When RegexFinder processes an invalid regex, the game crashes.

Expected behavior
AdvancedChatCore should handle any and all possible errors that could occur while handling a chat message.

While invalid regexes could additionally be rejected in the editor gui and never saved to begin with, that alone would not be very robust.

Minecraft Info

  • AdvancedChatBox-1.18-1.1.3
  • AdvancedChatCore-1.18.2-1.5.0
  • AdvancedChatFilters-1.18.2-1.2.3
  • AdvancedChatHUD-1.18.2-1.3.2
  • AdvancedChatLog-1.18.2-1.2.1
  • AdvancedChatMacros-1.18.2-1.0.0

To Reproduce

  1. edit the regex of one of the chat tabs in, I believe, AdvancedChatFilters
  2. while editing the regex, it becomes invalid due to being in the process of being edited
  3. with the editor still open, the game receives a chat message
  4. the game crashes with the stacktrace
java.util.regex.PatternSyntaxException: Unmatched closing ')' near index 85
^(\[[:0-9]+\] )?\[CR\] [§A-Za-z0-9_]{3,17} (appeared on|disappeared from) radar|() the).*
                                                                                     ^
	at Not Enough Crashes deobfuscated stack trace.(1.18.2+build.2)
	at java.base/java.util.regex.Pattern.error(Pattern.java:2038)
	at java.base/java.util.regex.Pattern.compile(Pattern.java:1797)
	at java.base/java.util.regex.Pattern.<init>(Pattern.java:1440)
	at java.base/java.util.regex.Pattern.compile(Pattern.java:1079)
	at io.github.darkkronicle.advancedchatcore.finder.RegexFinder.getPattern(RegexFinder.java:25)
	at io.github.darkkronicle.advancedchatcore.finder.PatternFinder.isMatch(PatternFinder.java:23)
	at io.github.darkkronicle.advancedchatcore.util.SearchUtils.isMatch(SearchUtils.java:51)
	at io.github.darkkronicle.advancedchathud.tabs.CustomChatTab$1.parse(CustomChatTab.java:76)
	at io.github.darkkronicle.advancedchathud.tabs.CustomChatTab.shouldAdd(CustomChatTab.java:95)
	at io.github.darkkronicle.advancedchathud.HudChatMessage.<init>(HudChatMessage.java:33)
	at io.github.darkkronicle.advancedchathud.HudChatMessageHolder.onMessageUpdate(HudChatMessageHolder.java:36)
	at io.github.darkkronicle.advancedchatcore.chat.ChatHistory.sendUpdate(ChatHistory.java:78)
	at io.github.darkkronicle.advancedchatcore.chat.ChatHistory.add(ChatHistory.java:101)
	at io.github.darkkronicle.advancedchatcore.chat.ChatHistoryProcessor.process(ChatHistoryProcessor.java:71)
	at io.github.darkkronicle.advancedchatcore.interfaces.IMessageProcessor.filter(IMessageProcessor.java:28)
	at io.github.darkkronicle.advancedchatcore.chat.MessageDispatcher.process(MessageDispatcher.java:133)
	at io.github.darkkronicle.advancedchatcore.chat.MessageDispatcher.handleText(MessageDispatcher.java:118)
	at net.minecraft.class_338.handler$zzc000$addMessage(class_338.java:2038)
	at net.minecraft.class_338.method_1804(class_338.java)
	at net.minecraft.class_338.method_1812(class_338.java:162)
	at net.minecraft.class_746.method_9203(class_746.java:492)
	at com.aleksey.combatradar.Radar.sendMessage(Radar.java:564)
	at com.aleksey.combatradar.Radar.sendMessages(Radar.java:496)
	at com.aleksey.combatradar.ModHelper.tick(ModHelper.java:74)
	at com.aleksey.combatradar.fabric.FabricModCombatRadar.lambda$init$1(FabricModCombatRadar.java:29)
	at org.quiltmc.qsl.lifecycle.api.client.event.ClientTickEvents.lambda$static$0(ClientTickEvents.java:42)
	at net.minecraft.class_310.handler$bmf002$startTick(class_310.java:15499)
@Gjum Gjum added the bug Something isn't working label Jun 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant