[jruby-joni] 21/279: Fix for JRUBY-2089: ArrayIndexOutOfBoundsException when evaluating regex with trailing \b.

Hideki Yamane henrich at moszumanska.debian.org
Mon Nov 16 11:26:32 UTC 2015


This is an automated email from the git hooks/post-receive script.

henrich pushed a commit to branch debian/sid
in repository jruby-joni.

commit f8ad5e2d63c6db61c5f88649ea30338eeaccae27
Author: Marcin Mielżyński <lopx at gazeta.pl>
Date:   Fri May 9 18:36:52 2008 +0000

    Fix for JRUBY-2089: ArrayIndexOutOfBoundsException when evaluating regex with trailing \b.
    
    git-svn-id: http://svn.codehaus.org/jruby/joni/trunk@6657 961051c9-f516-0410-bf72-c9f7e237a7b7
---
 src/org/joni/ByteCodeMachine.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/org/joni/ByteCodeMachine.java b/src/org/joni/ByteCodeMachine.java
index e835e03..9ccde09 100644
--- a/src/org/joni/ByteCodeMachine.java
+++ b/src/org/joni/ByteCodeMachine.java
@@ -1031,7 +1031,7 @@ class ByteCodeMachine extends StackMachine {
             if (s >= range) {opFail(); return;}
             if (!enc.isWord(bytes[s] & 0xff)) {opFail(); return;}
         } else if (s == end) {
-            if (!enc.isWord(bytes[sprev] & 0xff)) {opFail(); return;}
+            if (sprev >= end || !enc.isWord(bytes[sprev] & 0xff)) {opFail(); return;}
         } else {
             if (enc.isWord(bytes[s] & 0xff) == enc.isWord(bytes[sprev] & 0xff)) {opFail(); return;}
         }
@@ -1051,7 +1051,7 @@ class ByteCodeMachine extends StackMachine {
         if (s == str) {
             if (s < range && enc.isWord(bytes[s] & 0xff)) {opFail(); return;}
         } else if (s == end) {
-            if (enc.isWord(bytes[sprev] & 0xff)) {opFail(); return;}
+            if (sprev < end && enc.isWord(bytes[sprev] & 0xff)) {opFail(); return;}
         } else {
             if (enc.isWord(bytes[s] & 0xff) != enc.isWord(bytes[sprev] & 0xff)) {opFail(); return;}
         }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jruby-joni.git



More information about the pkg-java-commits mailing list