toNumber(String) accepts illegal characters

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 9
    • Affects Version/s: None
    • Component/s: core-libs
    • None
    • b57
    • generic
    • generic

        We use java.lang.Double.parseDouble(String) in JSType.toNumber(String). However, that method allows some characters such as trailing 'f' or 'd' that are not allowed by ECMA spec (9.3.1):

        "0.5d"
        "1f"

        We need to improve our checks. This may also help improve performance as more input strigns are converted to NaN without a NumberFormatException being thrown.

              Assignee:
              Hannes Wallnoefer
              Reporter:
              Hannes Wallnoefer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: