mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-10-05 15:23:29 +01:00
Validate sticker IDs during export.
This commit is contained in:
1 parent
252b1dbb2d
commit
655da1de76
2 files changed
+6
-6
No files matched your search
+4
-4
@@ -983,16 +983,16 @@ private fun DatabaseAttachment.toRemoteStickerMessage(sentTimestamp: Long, media
|
||||
val stickerLocator = this.stickerLocator!!
|
||||
|
||||
val packId = try {
|
||||
Hex.fromStringCondensed(stickerLocator.packId)
|
||||
Hex.fromStringCondensed(stickerLocator.packId).takeIf { it.size == 16 } ?: throw IOException("Incorrect length!")
|
||||
} catch (e: IOException) {
|
||||
Log.w(TAG, ExportSkips.invalidChatItemStickerPackId(sentTimestamp))
|
||||
Log.w(TAG, ExportSkips.invalidChatItemStickerPackId(sentTimestamp), e)
|
||||
return null
|
||||
}
|
||||
|
||||
val packKey = try {
|
||||
Hex.fromStringCondensed(stickerLocator.packKey)
|
||||
Hex.fromStringCondensed(stickerLocator.packKey).takeIf { it.size == 32 } ?: throw IOException("Incorrect length!")
|
||||
} catch (e: IOException) {
|
||||
Log.w(TAG, ExportSkips.invalidChatItemStickerPackKey(sentTimestamp))
|
||||
Log.w(TAG, ExportSkips.invalidChatItemStickerPackKey(sentTimestamp), e)
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -68,14 +68,14 @@ object StickerArchiveProcessor {
|
||||
|
||||
private fun StickerPackRecord.toBackupFrame(): Frame? {
|
||||
val packIdBytes = try {
|
||||
Hex.fromStringCondensed(this.packId)
|
||||
Hex.fromStringCondensed(this.packId)?.takeIf { it.size == 16 } ?: throw IOException("Incorrect length!")
|
||||
} catch (e: IOException) {
|
||||
Log.w(TAG, ExportSkips.invalidStickerPackId())
|
||||
return null
|
||||
}
|
||||
|
||||
val packKeyBytes = try {
|
||||
Hex.fromStringCondensed(this.packKey)
|
||||
Hex.fromStringCondensed(this.packKey)?.takeIf { it.size == 32 } ?: throw IOException("Incorrect length!")
|
||||
} catch (e: IOException) {
|
||||
Log.w(TAG, ExportSkips.invalidStickerPackKey())
|
||||
return null
|
||||
|
||||
Reference in new issue
Block a user