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

JSON.parse('{"0":0, "64":0}') throws ArrayindexOutOfBoundsException

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b22
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        jjs -J-Djava.ext.dirs=$jdk9_dev/nashorn/dist/ -doe

        jjs> JSON.parse('{"0":0, "64":0}')

        java.lang.ArrayIndexOutOfBoundsException: 64
        java.lang.ArrayIndexOutOfBoundsException: 64
        at jdk.nashorn.internal.runtime.arrays.IntArrayData.set(IntArrayData.java:215)
        at jdk.nashorn.internal.runtime.arrays.IntArrayData.set(IntArrayData.java:204)
        at jdk.nashorn.internal.runtime.arrays.ArrayFilter.set(ArrayFilter.java:102)
        at jdk.nashorn.internal.runtime.arrays.DeletedRangeArrayFilter.set(DeletedRangeArrayFilter.java:132)
        at jdk.nashorn.internal.runtime.ScriptObject.defineOwnProperty(ScriptObject.java:694)
        at jdk.nashorn.internal.runtime.JSONFunctions.setPropertyValue(JSONFunctions.java:200)
        at jdk.nashorn.internal.runtime.JSONFunctions.convertNode(JSONFunctions.java:182)
        at jdk.nashorn.internal.runtime.JSONFunctions.parse(JSONFunctions.java:93)
        at jdk.nashorn.internal.objects.NativeJSON.parse(NativeJSON.java:105)
        at jdk.nashorn.internal.scripts.Script$Recompilation$3$\^shell\_.:program(<shell>:1)
        at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:567)
        at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:222)
        at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:375)
        at jdk.nashorn.internal.runtime.Context.eval(Context.java:633)
        at jdk.nashorn.internal.runtime.Context.eval(Context.java:563)
        at jdk.nashorn.tools.Shell.readEvalPrint(Shell.java:448)
        at jdk.nashorn.tools.Shell.run(Shell.java:158)
        at jdk.nashorn.tools.Shell.main(Shell.java:133)
        at jdk.nashorn.tools.Shell.main(Shell.java:112)

        The above works fine with jdk8 GA as well as jdk8u-dev tip build

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  sundar Sundararajan Athijegannathan
                  Reporter:
                  sundar Sundararajan Athijegannathan
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: