From d659c25fe01303db1872fd7793f96e4e5de1d683 Mon Sep 17 00:00:00 2001 From: Harry <109690906+harry-signal@users.noreply.github.com> Date: Mon, 9 Sep 2024 16:38:26 -0700 Subject: [PATCH] Don't include an incremental mac for InvalidAttachmentLocator FilePointers --- src/main/kotlin/Permutations.kt | 12 ++++++++---- test-cases/account_data_08.binproto | Bin 388 -> 367 bytes test-cases/account_data_08.txtproto | 2 -- test-cases/chat_07.binproto | Bin 495 -> 474 bytes test-cases/chat_07.txtproto | 2 -- .../chat_item_contact_message_08.binproto | Bin 809 -> 788 bytes .../chat_item_contact_message_08.txtproto | 2 -- ...tem_standard_message_long_text_08.binproto | Bin 585 -> 564 bytes ...tem_standard_message_long_text_08.txtproto | 2 -- ...rd_message_special_attachments_07.binproto | Bin 565 -> 544 bytes ...rd_message_special_attachments_07.txtproto | 2 -- ...d_message_standard_attachments_02.binproto | Bin 1040 -> 1019 bytes ...d_message_standard_attachments_02.txtproto | 2 -- ...d_message_standard_attachments_05.binproto | Bin 1117 -> 1096 bytes ...d_message_standard_attachments_05.txtproto | 2 -- ...d_message_standard_attachments_08.binproto | Bin 1130 -> 1109 bytes ...d_message_standard_attachments_08.txtproto | 2 -- ...d_message_standard_attachments_11.binproto | Bin 1169 -> 1148 bytes ...d_message_standard_attachments_11.txtproto | 2 -- ...d_message_standard_attachments_13.binproto | Bin 810 -> 789 bytes ...d_message_standard_attachments_13.txtproto | 2 -- .../chat_item_sticker_message_07.binproto | Bin 616 -> 595 bytes .../chat_item_sticker_message_07.txtproto | 2 -- 23 files changed, 8 insertions(+), 26 deletions(-) diff --git a/src/main/kotlin/Permutations.kt b/src/main/kotlin/Permutations.kt index 842637a..f800412 100644 --- a/src/main/kotlin/Permutations.kt +++ b/src/main/kotlin/Permutations.kt @@ -367,16 +367,20 @@ object Generators { ) return Generators.permutation { - val incrementalMac: ByteArray? = some(Generators.bytes(16).nullable()) + val backupLocator: FilePointer.BackupLocator? = someOneOf(backupLocatorGenerator) + val attachmentLocator: FilePointer.AttachmentLocator? = someOneOf(attachmentLocatorGenerator) + val invalidAttachmentLocator: FilePointer.InvalidAttachmentLocator? = someOneOf(invalidAttachmentLocatorGenerator) + val potentialIncrementalMac = some(Generators.bytes(16).nullable()) + val incrementalMac = if (invalidAttachmentLocator == null) potentialIncrementalMac else null val incrementalMacChunkSize: Int? = some(Generators.list(1024, 2048)) val contentType = some(contentTypeGenerator) val blurHash = some(Generators.blurHashes().nullable()) frames += FilePointer( - backupLocator = someOneOf(backupLocatorGenerator), - attachmentLocator = someOneOf(attachmentLocatorGenerator), - invalidAttachmentLocator = someOneOf(invalidAttachmentLocatorGenerator), + backupLocator = backupLocator, + attachmentLocator = attachmentLocator, + invalidAttachmentLocator = invalidAttachmentLocator, contentType = contentType, incrementalMac = incrementalMac?.toByteString(), incrementalMacChunkSize = if (incrementalMac != null) { diff --git a/test-cases/account_data_08.binproto b/test-cases/account_data_08.binproto index f39e793733388985c6e09b8c9f54c4ffdcc614af..0197cee7cca873561e2f0c1d8e3927616ead8689 100644 GIT binary patch delta 45 zcmZo+e$T|m$-yXaajl-nw~(=O;s#AVeIacn&dl7z^i=(Vy!45GIskBV B5UcDO=WiN1UXDSe| YCX8LEXXvz4bwgRyGkQEQfDn=Ah%%WOn*aa+ diff --git a/test-cases/account_data_08.txtproto b/test-cases/account_data_08.txtproto index f633387..00ee5d3 100644 --- a/test-cases/account_data_08.txtproto +++ b/test-cases/account_data_08.txtproto @@ -37,8 +37,6 @@ Frame { wallpaperPhoto = FilePointer { blurHash = "LfLh6Voa9NIW?wNF-ooL-;WAX8oy" contentType = "image/png" - incrementalMac = - incrementalMacChunkSize = 2048 invalidAttachmentLocator = InvalidAttachmentLocator {} } } diff --git a/test-cases/chat_07.binproto b/test-cases/chat_07.binproto index 69962cc7042ebe58b47d3d88ef78c2050d37065f..528b994e3ec6c27b11632af53ec539d613cc3438 100644 GIT binary patch delta 50 zcmV-20L}mJ1KIDO=WiN1U IXOqnVBEr29=l}o! delta 71 zcmV-N0J#6!1MdT{k^wth8d?Yg5Ck9rDA0}3!_NpX{DO=WiN1U dXDSe|CX8LEXXvz4bwgRyGkQEQfDn_o0V1;a8o~eo diff --git a/test-cases/chat_07.txtproto b/test-cases/chat_07.txtproto index 39b5daf..939af20 100644 --- a/test-cases/chat_07.txtproto +++ b/test-cases/chat_07.txtproto @@ -117,8 +117,6 @@ Frame { wallpaperPhoto = FilePointer { blurHash = "LfLh6Voa9NIW?wNF-ooL-;WAX8oy" contentType = "image/png" - incrementalMac = - incrementalMacChunkSize = 2048 invalidAttachmentLocator = InvalidAttachmentLocator {} } } diff --git a/test-cases/chat_item_contact_message_08.binproto b/test-cases/chat_item_contact_message_08.binproto index 3620373a99072671b698b1c7ff59ca0795544f88..8a9271613bd4a8fb6f0b944a2142281db8f61ea9 100644 GIT binary patch delta 59 zcmV-B0L1^P29yS{nE@U70wVST2m%lR7_QNr?ej271_}fS1Tp|(-~tNWv$g>t0Sr7M R32AL%XJs#NZfBGD0x>?H6CVHo delta 80 zcmV-W0I&a)2B`+HnE@S+10st92m%lR7_QNr?ej271_}fS1Tp|(^#Tg=v$g>t0U=Q$ m32AL%XJs#NZf7bGSsv?~HOO|ne_I>qhYxuIFn|z~;{q}Jml~b` diff --git a/test-cases/chat_item_contact_message_08.txtproto b/test-cases/chat_item_contact_message_08.txtproto index 36326ee..8b81c00 100644 --- a/test-cases/chat_item_contact_message_08.txtproto +++ b/test-cases/chat_item_contact_message_08.txtproto @@ -140,8 +140,6 @@ Frame { contentType = "image/png" fileName = "wPOZvhLDS" height = 3033 - incrementalMac = <591eeb9b35c876bc7f5b1be8870f7902> - incrementalMacChunkSize = 2048 invalidAttachmentLocator = InvalidAttachmentLocator {} width = 267 } diff --git a/test-cases/chat_item_standard_message_long_text_08.binproto b/test-cases/chat_item_standard_message_long_text_08.binproto index 28493ddf9f08b85b96fefcd05f8385681e01571d..02d6666c834789618e702b80ed4532c50b6ee1a2 100644 GIT binary patch delta 65 zcmX@fvV~>COh(h0j7rlOIhX_(CAM9h^Y*iW7aJD~2a6FyR0E?BHy3AQc$!N{dV!~x VmWvW+W^Q77s(yNA+T_QKX#jO_6I%cP delta 86 zcmV-c0IC191jz)jnE^_!0V1mb2m%lR7`D-z?ej271_}fS1Tp|xl>rh93JF - incrementalMacChunkSize = 2048 invalidAttachmentLocator = InvalidAttachmentLocator {} width = 21 } diff --git a/test-cases/chat_item_standard_message_special_attachments_07.binproto b/test-cases/chat_item_standard_message_special_attachments_07.binproto index cd6093461fed5f18d2050ad4c5ad16277e2f28db..f4f5f4490ea82ec7a344b362c841ee71b7041de1 100644 GIT binary patch delta 37 tcmdnWvVdj7Oh%SgMy007a~b6XQl$L3yp=dJa}(23^$YUSCqG~e1pwG(3&H>Z delta 58 zcmV-A0LA~H1hoXPnE?cv0V0=^odF&tc^YI2U?K@=ZDD6+FK}*WDiCI& - incrementalMacChunkSize = 2048 invalidAttachmentLocator = InvalidAttachmentLocator {} width = 665 } diff --git a/test-cases/chat_item_standard_message_standard_attachments_02.binproto b/test-cases/chat_item_standard_message_standard_attachments_02.binproto index 1f225fda6e4967b7bc456e3b1267018e360d5633..b0af00281f5757a45cc0682564cdd5277d7f3af6 100644 GIT binary patch delta 58 zcmV-A0LA~12>S=HnE@K$1R~u82m%lR7_iZt?ej271_}fS1R4NZ$Fs8mbpZ}c3Q8gg QX>DO=WiMxGW|K<;#V|$^uK)l5 delta 79 zcmV-V0I>i22apJ`nE@L01S0YT2m%lR7_iZt?ej271_}fS1R4NZ+_SR*bpaz`3SS}# lX>DO=WiMxGW-1UOt$>NxvmOhLU`dr-sF^M>fDn^51H~z!8#Mp` diff --git a/test-cases/chat_item_standard_message_standard_attachments_02.txtproto b/test-cases/chat_item_standard_message_standard_attachments_02.txtproto index 973541d..ed1760a 100644 --- a/test-cases/chat_item_standard_message_standard_attachments_02.txtproto +++ b/test-cases/chat_item_standard_message_standard_attachments_02.txtproto @@ -189,8 +189,6 @@ Frame { contentType = "image/gif" fileName = "zeAEZObFnzTZMn" height = 3097 - incrementalMac = <22ad8089d8b31e0b8d6049955da8992e> - incrementalMacChunkSize = 2048 invalidAttachmentLocator = InvalidAttachmentLocator {} width = 3092 } diff --git a/test-cases/chat_item_standard_message_standard_attachments_05.binproto b/test-cases/chat_item_standard_message_standard_attachments_05.binproto index 9eea78f5db13250528d3f78f7f8d08818ffab3c0..ac9a0dae8e8aadcf97a5fdb84ace9949dbb873e0 100644 GIT binary patch delta 42 ycmcc1ae`yROh%TqtV*jU&t(*6oHThW<8MA6E-xj{%-qEERQ>eKw9S{9x)=dRcn - incrementalMacChunkSize = 2048 invalidAttachmentLocator = InvalidAttachmentLocator {} width = 3092 } diff --git a/test-cases/chat_item_standard_message_standard_attachments_08.binproto b/test-cases/chat_item_standard_message_standard_attachments_08.binproto index 794597bce0549e5efa86eb0d93c75057821cb183..671e262639e938ce715a86781361531ac28cc88a 100644 GIT binary patch delta 58 zcmV-A0LB062-OI%nE@KQ1tPZv2m%lR7`D-z?ej271_}fS1Tp|xp_8)#We!XVN+Jnq QZDD6+FK20HvpWJW0xud7+yDRo delta 62 zcmV-E0Kxy&2 - incrementalMacChunkSize = 2048 invalidAttachmentLocator = InvalidAttachmentLocator {} width = 3092 } diff --git a/test-cases/chat_item_standard_message_standard_attachments_11.binproto b/test-cases/chat_item_standard_message_standard_attachments_11.binproto index ec8addb8478dd4d07ef178d5758b5b89b2d4d038..18a3e047c76568d25306ede72c389e7cec8b3f00 100644 GIT binary patch delta 68 zcmV-K0K5N@3H%7KnE^N91tQ)B2m%lR7`f4$?ej271_}fS1VR8>$ORG$3JF-31a03JF - incrementalMacChunkSize = 2048 invalidAttachmentLocator = InvalidAttachmentLocator {} width = 3092 } diff --git a/test-cases/chat_item_standard_message_standard_attachments_13.binproto b/test-cases/chat_item_standard_message_standard_attachments_13.binproto index 7bc8d332d7c56e0d6a22132ea1a19e1302e0d47e..ea1d3a1c5907bdcc27a261e097ed3557851c1766 100644 GIT binary patch delta 42 ycmZ3*HkEC|Oh(pUOiJIGCeLG(WxO$Y594n>A1*H?&dl7z^i=)y%(Th3m;wMs)ej{A delta 46 zcmbQrwu)`TOh(pzW~CnH$@3Ux8Q)Ic!}yyokt<$_Gcz|aJykzFGi~xkMzP7qnEU~5 COAqz{ diff --git a/test-cases/chat_item_standard_message_standard_attachments_13.txtproto b/test-cases/chat_item_standard_message_standard_attachments_13.txtproto index 2385ce4..17844e7 100644 --- a/test-cases/chat_item_standard_message_standard_attachments_13.txtproto +++ b/test-cases/chat_item_standard_message_standard_attachments_13.txtproto @@ -177,8 +177,6 @@ Frame { contentType = "image/gif" fileName = "zeAEZObFnzTZMn" height = 3097 - incrementalMac = <22ad8089d8b31e0b8d6049955da8992e> - incrementalMacChunkSize = 2048 invalidAttachmentLocator = InvalidAttachmentLocator {} width = 3092 } diff --git a/test-cases/chat_item_sticker_message_07.binproto b/test-cases/chat_item_sticker_message_07.binproto index eaa114996e404678b110f3b4a59ddda454bd30be..1cf78448368ea3a14c7eceb2a0a1b8e8a3073ea1 100644 GIT binary patch delta 43 zcmaFCa+zhrOh%R+j7nQ4&t;Tjna0S~FnK?t9j}uTS7vTvda8b6L0DO=WiMfHZf7bGz3 - incrementalMacChunkSize = 2048 invalidAttachmentLocator = InvalidAttachmentLocator {} width = 3822 }