Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8075927

toNumber(String) accepts illegal characters

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • None
    • 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.

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

                Created:
                Updated:
                Resolved: