Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a89c41295f9950e9c5881b77e2cef84972d5ffdb
      
https://github.com/WebKit/WebKit/commit/a89c41295f9950e9c5881b77e2cef84972d5ffdb
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-09-14 (Mon, 14 Sep 2026)

  Changed paths:
    A JSTests/stress/bigint-from-string-sign-or-prefix-only.js
    M Source/JavaScriptCore/runtime/JSBigInt.cpp

  Log Message:
  -----------
  [JSC] `BigInt("-")` and `BigInt("0x ")` should throw a `SyntaxError`
https://bugs.webkit.org/show_bug.cgi?id=324127

Reviewed by Marcus Plutowski.

StringToBigInt returned 0n for a string that has only a sign ("-", " + ")
or only a radix prefix followed by white space ("0x "). The spec requires
at least one digit after either of them.

Disallow an empty digit sequence once a sign is consumed, and trim the
trailing white space before checking for it.

Test: JSTests/stress/bigint-from-string-sign-or-prefix-only.js

* JSTests/stress/bigint-from-string-sign-or-prefix-only.js: Added.
(shouldBe):
(looseEqual):
(greaterOrEqual):
(less):
(const.string.of.invalid.shouldThrowSyntaxError):
* Source/JavaScriptCore/runtime/JSBigInt.cpp:
(JSC::JSBigInt::parseInt):

Canonical link: https://commits.webkit.org/321129@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to