AliucordPlugins icon indicating copy to clipboard operation
AliucordPlugins copied to clipboard

[Base64] Crashes when trying to decode an Incomplete/Incorrect Base64 Message

Open RedrcknRbn opened this issue 1 year ago • 0 comments

When attempting to decode an incomplete/broken Base64 message, the entire client crashes. Logs:

java.lang.IllegalArgumentException: bad base-64
	at android.util.Base64.decode(Base64.java:163)
	at android.util.Base64.decode(Base64.java:138)
	at android.util.Base64.decode(Base64.java:120)
	at com.aliucord.plugins.Base64.lambda$start$1(Base64.java:54)
	at com.aliucord.plugins.Base64$$ExternalSyntheticLambda0.onClick(Unknown Source:4)
	at android.view.View.performClick(View.java:7892)
	at android.widget.TextView.performClick(TextView.java:16219)
	at android.view.View.performClickInternal(View.java:7869)
	at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
	at android.view.View$PerformClick.run(View.java:30880)
	at android.os.Handler.handleCallback(Handler.java:942)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:226)
	at android.os.Looper.loop(Looper.java:313)
	at android.app.ActivityThread.main(ActivityThread.java:8757)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

How to reproduce: I have an incorrect Base64 Script here that upon decode attempt, the client crashes: g SWYgdGhleSBkaWRuJ3QgZ2l2ZSB5b3UgcGVybWlzc2lvbiB0byBwb3N0IGl0LCBpdCB1c3VhbGx5 IGZhbGxzIHVuZGVyIHRoaXMgcnVsZQojIyBSdWxlIDQ6IE5vIEJ5cGFzc2VzIC0gRGVwZW5kcyBv biB0aGUgcnVsZQojIyMgQW55IGF0dGVtcHQgdG8gYnlwYXNzIGEgcnVsZSBsaXN0ZWQgaGVyZSBp

The plugin should be able to check if the message can actually be converted into Base64, and if it doesn't, fallback to an error message instead of crashing.

RedrcknRbn avatar Sep 06 '23 05:09 RedrcknRbn