From 72bb01346f37244331c3c8173f6dc72101d44662 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Thu, 23 Jun 2022 15:42:19 -0700 Subject: [PATCH] Check that size is number, not truthiness of size --- ts/textsecure/processDataMessage.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ts/textsecure/processDataMessage.ts b/ts/textsecure/processDataMessage.ts index 721c08fe47..7fa08b8eaa 100644 --- a/ts/textsecure/processDataMessage.ts +++ b/ts/textsecure/processDataMessage.ts @@ -3,6 +3,7 @@ import Long from 'long'; import { ReceiptCredentialPresentation } from '@signalapp/libsignal-client/zkgroup'; +import { isNumber } from 'lodash'; import { assert, strictAssert } from '../util/assert'; import { dropNull, shallowDropNull } from '../util/dropNull'; @@ -50,7 +51,7 @@ export function processAttachment( const hasCdnId = Long.isLong(cdnId) ? !cdnId.isZero() : Boolean(cdnId); const { contentType, digest, key, size } = attachment; - if (!size) { + if (!isNumber(size)) { throw new Error('Missing size on incoming attachment!'); }