diff --git a/ts/messageModifiers/AttachmentDownloads.ts b/ts/messageModifiers/AttachmentDownloads.ts index 1b322b217391..f08e7af40ee9 100644 --- a/ts/messageModifiers/AttachmentDownloads.ts +++ b/ts/messageModifiers/AttachmentDownloads.ts @@ -289,7 +289,7 @@ async function _runJob(job?: AttachmentDownloadJobType): Promise { const { size } = attachment; const sizeInKib = size / KIBIBYTE; - if (!size || sizeInKib > maxInKib) { + if (!Number.isFinite(size) || size < 0 || sizeInKib > maxInKib) { throw new AttachmentSizeError( `Attachment Job ${id}: Attachment was ${sizeInKib}kib, max is ${maxInKib}kib` );