Skip to content

Security: Incorrect Fallback Value for Number.MIN_SAFE_INTEGER - #3479

Open
tomaioo wants to merge 1 commit into
char0n:masterfrom
tomaioo:fix/security/incorrect-fallback-value-for-number-min-
Open

Security: Incorrect Fallback Value for Number.MIN_SAFE_INTEGER#3479
tomaioo wants to merge 1 commit into
char0n:masterfrom
tomaioo:fix/security/incorrect-fallback-value-for-number-min-

Conversation

@tomaioo

@tomaioo tomaioo commented Jul 31, 2026

Copy link
Copy Markdown

Summary

Security: Incorrect Fallback Value for Number.MIN_SAFE_INTEGER

Problem

Severity: Medium | File: src/internal/ponyfills/Number.MIN_SAFE_INTEGER.js:L1

The fallback value for Number.MIN_SAFE_INTEGER is calculated as -(2 ** 53) - 1, which evaluates to -9007199254740993. However, the correct value for Number.MIN_SAFE_INTEGER is -9007199254740992 (i.e., -(2 ** 53) + 1 or -(2 ** 53 - 1)). This off-by-one error results in an incorrect constant being used in environments where Number.MIN_SAFE_INTEGER is not natively defined.

Solution

Fix the fallback calculation to -(2 ** 53 - 1) or -(2 ** 53) + 1 to ensure the correct value for Number.MIN_SAFE_INTEGER is used.

Changes

  • src/internal/ponyfills/Number.MIN_SAFE_INTEGER.js (modified)

The fallback value for `Number.MIN_SAFE_INTEGER` is calculated as `-(2 ** 53) - 1`, which evaluates to `-9007199254740993`. However, the correct value for `Number.MIN_SAFE_INTEGER` is `-9007199254740992` (i.e., `-(2 ** 53) + 1` or `-(2 ** 53 - 1)`). This off-by-one error results in an incorrect constant being used in environments where `Number.MIN_SAFE_INTEGER` is not natively defined.

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant