-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
The Hash#shift method appears to break at capacity boundaries, such as the default size of 8:
h = {}
8.times {|j| h[j] = j}
p h
h.shiftThis produces an ArrayIndexOutOfBoundsException:
Unhandled Java exception: java.lang.ArrayIndexOutOfBoundsException: 16
java.lang.ArrayIndexOutOfBoundsException: 16
shift at org/jruby/RubyHash.java:1921
call at org/jruby/RubyHash$INVOKER$i$0$0$shift.gen:-1
cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:323
call at org/jruby/runtime/callsite/CachingCallSite.java:139
invokeOther5:shift at -e:1
<main> at -e:1
invokeWithArguments at java/lang/invoke/MethodHandle.java:627
load at org/jruby/ir/Compiler.java:94
runScript at org/jruby/Ruby.java:852
runNormally at org/jruby/Ruby.java:771
runNormally at org/jruby/Ruby.java:789
runFromMain at org/jruby/Ruby.java:601
doRunFromMain at org/jruby/Main.java:415
internalRun at org/jruby/Main.java:307
run at org/jruby/Main.java:234
main at org/jruby/Main.java:206
The cause appears to be lack of a guard for the end value being just beyond the end of the current entries store.
Fix coming.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels