Skip to content

Commit c34d8f8

Browse files
committed
add size check
1 parent 20a5c6a commit c34d8f8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/stable/lib/error.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ export function validateUnsignedInteger(
4545
throw new Error(`${errorPrefix} cannot be negative`);
4646
}
4747

48+
if (size > 53) {
49+
throw new Error(
50+
`${errorPrefix} to remain within safe integer bounds, size cannot be greater than 53`
51+
);
52+
}
53+
4854
const maxUnsignedInteger = Math.pow(2, size) - 1;
4955

5056
if (number > maxUnsignedInteger) {

0 commit comments

Comments
 (0)