From 91132a2182746dcab533b0a757839d5271777265 Mon Sep 17 00:00:00 2001 From: AlCalzone Date: Mon, 15 Jul 2024 13:49:50 +0200 Subject: [PATCH] fix: encoding of empty fixed-size bitmasks (#7013) --- packages/core/src/values/Primitive.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/values/Primitive.ts b/packages/core/src/values/Primitive.ts index 0e4bc75384a5..2b96faa61200 100644 --- a/packages/core/src/values/Primitive.ts +++ b/packages/core/src/values/Primitive.ts @@ -262,7 +262,7 @@ export function encodeBitMask( maxValue: number = Math.max(...values), startValue: number = 1, ): Buffer { - if (values.length === 0) return Buffer.from([0]); + if (!Number.isFinite(maxValue)) return Buffer.from([0]); const numBytes = Math.ceil((maxValue - startValue + 1) / 8); const ret = Buffer.alloc(numBytes, 0);