mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-09-23 10:12:07 +01:00
Catch malformed percent escapes when parsing call link urls.
This commit is contained in:
@@ -110,6 +110,9 @@ object CallLinks {
|
||||
} catch (_: UnsupportedEncodingException) {
|
||||
Log.w(TAG, "Invalid url: $url")
|
||||
return null
|
||||
} catch (_: IllegalArgumentException) {
|
||||
Log.w(TAG, "Invalid url: $url")
|
||||
return null
|
||||
}
|
||||
|
||||
val key = fragmentQuery[ROOT_KEY]
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2026 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.thoughtcrime.securesms.calls.links
|
||||
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.BeforeClass
|
||||
import org.junit.Test
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.thoughtcrime.securesms.testutil.EmptyLogger
|
||||
|
||||
/**
|
||||
* See [CallLinks]
|
||||
*/
|
||||
class CallLinksTest {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
@BeforeClass
|
||||
fun setUpClass() {
|
||||
Log.initialize(EmptyLogger())
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `parseUrl returns null for malformed percent escape instead of throwing`() {
|
||||
assertNull(CallLinks.parseUrl("https://signal.link/call/#key=abcdef&n=%ZZ"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `parseUrl returns null for malformed percent escape in key instead of throwing`() {
|
||||
assertNull(CallLinks.parseUrl("https://signal.link/call/#key=%ZZ"))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user