Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Zlib crc32 resulting into Java::JavaLang::ArrayIndexOutOfBoundsException (32) #5290
After https://github.com/jruby/jruby/pull/5088/files was merged:
This passes successfully on ruby 2.5.1 as:
Related on why ruby seems to allows this: ruby/ruby@778796b
I'm having a little trouble figuring out the right way to address this.
The fix in MRI seems to try to force longs into UINT, because that's what the zlib functions accept. Am I following correctly?
We use a pure-Java zlib port called jzlib, which always uses 64-bit signed longs for this parameter. So it seems like the only thing we need to do is to normalize negative long values passed in to their positive equivalents, rather than doing this extra loop to handle UINT-sized chunks. But I'm not sure if this is going to produce the equivalent values as MRI.
This error will occur only for negative long numbers. CRC32 requires the initial value (say
The size of lookup table
The immediate fix for this would be to trim the 64-bit hex to 32-bit using