JRuby

String#unpack('m') fails with ArrayIndexOutOfBoundsException

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: JRuby 1.1.6
  • Fix Version/s: JRuby 1.2
  • Component/s: Core Classes/Modules
  • Labels:
    None
  • Number of attachments :
    1

Description

# jirb
irb(main):001:0> JRUBY_VERSION
=> "1.1.6"
irb(main):001:0> "\222".unpack('m')
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -110
	at org.jruby.util.Pack.unpack(Pack.java:902)
	at org.jruby.RubyString.unpack(RubyString.java:3835)

org/jruby/util/Pack.java: problem is that safeGet() returns a signed byte, and uses that as index into b64_xtable.. negative index => ArrayIndexOutOfBoundsException

Activity

Hide
Charles Oliver Nutter added a comment -

Can you try this on a nightly build? I think it may be fixed. http://jruby.headius.com:8080/hudson under jruby-dist.

Show
Charles Oliver Nutter added a comment - Can you try this on a nightly build? I think it may be fixed. http://jruby.headius.com:8080/hudson under jruby-dist.
Hide
Jan Berkel added a comment -

just tried it, works ok in the nightly. thanks for the quick response.

Show
Jan Berkel added a comment - just tried it, works ok in the nightly. thanks for the quick response.
Hide
Charles Oliver Nutter added a comment -

Already fixed by some other commit.

Show
Charles Oliver Nutter added a comment - Already fixed by some other commit.
Hide
Jan Berkel added a comment -

patch fixing this problem (for people who need to get this working on 1.1.6)

Show
Jan Berkel added a comment - patch fixing this problem (for people who need to get this working on 1.1.6)

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: