JRuby

ArrayIndexOutOfBoundsException in tmail

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: JRuby 1.1.5
  • Fix Version/s: JRuby 1.2
  • Component/s: Application Error
  • Labels:
    None
  • Number of attachments :
    0

Description

See http://gist.github.com/22786 for reproduce instructions.

Activity

Hide
Tim Galeckas added a comment -

Also affects JRuby 1.1.6. The fix follows:

Index: src/org/jruby/util/Pack.java
===================================================================
— src/org/jruby/util/Pack.java (revision 8454)
+++ src/org/jruby/util/Pack.java (working copy)
@@ -1105,7 +1105,8 @@
};

private static byte safeGet(ByteBuffer encode) { - return encode.hasRemaining() ? encode.get() : 0; + byte rb = encode.hasRemaining() ? encode.get() : 0; + return rb >= 0 ? rb : 0; }

public static void decode(Ruby runtime, ByteBuffer encode, int occurrences,

Show
Tim Galeckas added a comment - Also affects JRuby 1.1.6. The fix follows: Index: src/org/jruby/util/Pack.java =================================================================== — src/org/jruby/util/Pack.java (revision 8454) +++ src/org/jruby/util/Pack.java (working copy) @@ -1105,7 +1105,8 @@ }; private static byte safeGet(ByteBuffer encode) { - return encode.hasRemaining() ? encode.get() : 0; + byte rb = encode.hasRemaining() ? encode.get() : 0; + return rb >= 0 ? rb : 0; } public static void decode(Ruby runtime, ByteBuffer encode, int occurrences,
Hide
Albert Strasheim added a comment -

Here's a simple test case:

str = "Her f\303\270lger"
str.unpack('m').first
Show
Albert Strasheim added a comment - Here's a simple test case:
str = "Her f\303\270lger"
str.unpack('m').first
Hide
Charles Oliver Nutter added a comment -

Resolved by fixes for JRUBY-3274.

Show
Charles Oliver Nutter added a comment - Resolved by fixes for JRUBY-3274.

People

Vote (1)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: