Commit 9ff33ec1 authored by Mygod's avatar Mygod

Fix IllegalArgumentException thrown by Base64.decode

parent a1aed680
...@@ -43,6 +43,7 @@ class Profile : Serializable { ...@@ -43,6 +43,7 @@ class Profile : Serializable {
fun findAll(data: CharSequence?) = pattern.findAll(data ?: "").map { fun findAll(data: CharSequence?) = pattern.findAll(data ?: "").map {
val uri = Uri.parse(it.value) val uri = Uri.parse(it.value)
try {
if (uri.userInfo == null) { if (uri.userInfo == null) {
val match = legacyPattern.matchEntire(String(Base64.decode(uri.host, Base64.NO_PADDING))) val match = legacyPattern.matchEntire(String(Base64.decode(uri.host, Base64.NO_PADDING)))
if (match != null) { if (match != null) {
...@@ -79,6 +80,10 @@ class Profile : Serializable { ...@@ -79,6 +80,10 @@ class Profile : Serializable {
null null
} }
} }
} catch (e: IllegalArgumentException) {
Log.e(TAG, "Invalid base64 detected: ${it.value}")
null
}
}.filterNotNull() }.filterNotNull()
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment