From 5c77c2e0b24f5f6b166026d87d4646920d9ed68d Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Fri, 28 Mar 2025 08:41:56 -0500 Subject: [PATCH] Fix multiplex backreferences near end of string in regexp match See https://bugs.ruby-lang.org/issues/18631 See https://github.com/ruby/ruby/pull/5710 --- 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 0870a99..b301311 100644 --- a/src/org/joni/ByteCodeMachine.java +++ b/src/org/joni/ByteCodeMachine.java @@ -1442,7 +1442,7 @@ private void opBackRefMulti() { int pend = backrefEnd(mem); int n = pend - pstart; - if (s + n > range) {opFail(); return;} + if (s + n > range) continue; sprev = s; int swork = s; @@ -1478,7 +1478,7 @@ private void opBackRefMultiIC() { int pend = backrefEnd(mem); int n = pend - pstart; - if (s + n > range) {opFail(); return;} + if (s + n > range) continue; sprev = s;