-
Sub-task
-
Resolution: Fixed
-
P4
-
9
-
None
-
b22
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8064149 | 8u45 | Attila Szegedi | P4 | Resolved | Fixed | b01 |
JDK-8055614 | 8u40 | Attila Szegedi | P4 | Resolved | Fixed | b04 |
JDK-8070386 | emb-8u47 | Attila Szegedi | P4 | Resolved | Fixed | team |
jjs -doe
jjs> s = " "; for (var i=0;i<31;++i) s+=s; s.length
-2147483648
jjs> s = " "; for (var i=0;i<31;++i) s+=s;
Exception in thread "main" java.lang.NegativeArraySizeException
at jdk.nashorn.internal.runtime.ConsString.flatten(ConsString.java:87)
at jdk.nashorn.internal.runtime.ConsString.flattened(ConsString.java:80)
at jdk.nashorn.internal.runtime.ConsString.toString(ConsString.java:60)
at jdk.nashorn.internal.runtime.JSType.toStringImpl(JSType.java:1295)
at jdk.nashorn.internal.runtime.JSType.toString(JSType.java:540)
at jdk.nashorn.tools.Shell.readEvalPrint(Shell.java:458)
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)
Perhaps we should catch NegativeArraySizeException and throw RangeError? In any case reporting negative length should be avoided.
jjs> s = " "; for (var i=0;i<31;++i) s+=s; s.length
-2147483648
jjs> s = " "; for (var i=0;i<31;++i) s+=s;
Exception in thread "main" java.lang.NegativeArraySizeException
at jdk.nashorn.internal.runtime.ConsString.flatten(ConsString.java:87)
at jdk.nashorn.internal.runtime.ConsString.flattened(ConsString.java:80)
at jdk.nashorn.internal.runtime.ConsString.toString(ConsString.java:60)
at jdk.nashorn.internal.runtime.JSType.toStringImpl(JSType.java:1295)
at jdk.nashorn.internal.runtime.JSType.toString(JSType.java:540)
at jdk.nashorn.tools.Shell.readEvalPrint(Shell.java:458)
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)
Perhaps we should catch NegativeArraySizeException and throw RangeError? In any case reporting negative length should be avoided.
- backported by
-
JDK-8055614 large string size RangeError should be thrown rather than reporting negative length
-
- Resolved
-
-
JDK-8064149 large string size RangeError should be thrown rather than reporting negative length
-
- Resolved
-
-
JDK-8070386 large string size RangeError should be thrown rather than reporting negative length
-
- Resolved
-