mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-08-04 20:34:14 +01:00
Fix single character group links crashing.
This commit is contained in:
committed by
Michelle Tang
parent
e458b3ff66
commit
9ca47f5fc5
@@ -58,7 +58,13 @@ public final class GroupInviteLinkUrl {
|
||||
throw new InvalidGroupLinkException("No reference was in the uri");
|
||||
}
|
||||
|
||||
byte[] bytes = Base64.decode(encoding);
|
||||
byte[] bytes;
|
||||
try {
|
||||
bytes = Base64.decode(encoding);
|
||||
} catch (IllegalArgumentException e) {
|
||||
throw new InvalidGroupLinkException(e);
|
||||
}
|
||||
|
||||
GroupInviteLink groupInviteLink = GroupInviteLink.ADAPTER.decode(bytes);
|
||||
|
||||
//noinspection SwitchStatementWithTooFewBranches
|
||||
|
||||
+9
@@ -76,6 +76,15 @@ class GroupInviteLinkUrl_InvalidGroupLinkException_Test {
|
||||
.isInstanceOf<IOException>()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun one_character_base64_ref() {
|
||||
val uri = "https://signal.group/#A"
|
||||
assertFailure { GroupInviteLinkUrl.fromUri(uri) }
|
||||
.isInstanceOf<InvalidGroupLinkException>()
|
||||
.rootCause()
|
||||
.isInstanceOf<IllegalArgumentException>()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bad_protobuf() {
|
||||
val uri = "https://signal.group/#CAESNAogpQEzURH6BON1bCS264cmTi37Yi6HTOReXZUEHdsBIgSEPCLfiL7k4wCXmwVi31USVY"
|
||||
|
||||
Reference in New Issue
Block a user