-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
The following script
require 'ipaddr'
r = IPAddr.new('1.2.3.4').to_range
r.hashocasionally generates the following exception:
RangeError: bignum too big to convert into `long'
hash at org/jruby/RubyRange.java:296
<main> at foo.rb:3
Related part of the code:
@JRubyMethod(name = "hash")
public RubyFixnum hash(ThreadContext context) {
long hash = isExclusive ? 1 : 0;
long h = hash;
long v = invokedynamic(context, begin, MethodNames.HASH).convertToInteger().getLongValue(); // <-- Line 296
hash ^= v << 1;
v = invokedynamic(context, end, MethodNames.HASH).convertToInteger().getLongValue();
hash ^= v << 9;
hash ^= h << 24;
return context.runtime.newFixnum(hash);
}Running r.begin.hash does not appear to break (it is hard to test however, since the exception doesn't happen every time)
Environment
Provide at least:
-
JRuby version (
jruby -v) and command line (flags, JRUBY_OPTS, etc)
jruby 9.1.7.0 (2.3.1) 2017-01-11 68056ae OpenJDK Server VM 25.111-b14 on 1.8.0_111-8u111-b14-2~bpo8+1-b14 +jit [linux-i386] (installed via rbenv, no extra command line options) -
Operating system and platform (e.g.
uname -a)
Linux 3.16.0-4-amd64 break script engine #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux (but running a 32-bit userspace)
Reactions are currently unavailable