aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse
diff options
context:
space:
mode:
authorRobin Stocker <robin@nibor.org>2013-05-27 20:56:31 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2013-05-28 01:40:13 +0200
commitec97912762754ee88f1af5ed80e993c545778242 (patch)
treeb0b41b34f5e01a1b68e696ec62ab48cb9ed5a2a6 /org.eclipse.jgit/src/org/eclipse
parent7bb2a1b8440386dead8b72c329b92e2473e89e32 (diff)
downloadjgit-ec97912762754ee88f1af5ed80e993c545778242.tar.gz
jgit-ec97912762754ee88f1af5ed80e993c545778242.zip
Fix multiple bugs in RawSubStringPattern used by MessageRevFilter
* Match at end of input was not handled correctly. * When more than one character matched but not all, the next character was not considered as a match start (e.g. pattern "abab" didn't match input "abaabab"). Bug: 409144 Change-Id: Ia44682c618bfbb927f5567c194227421d222a160 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/RawSubStringPattern.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/RawSubStringPattern.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/RawSubStringPattern.java
index 2f7f486e91..bc101bd7d7 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/RawSubStringPattern.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/RawSubStringPattern.java
@@ -95,21 +95,21 @@ public class RawSubStringPattern {
int matchPos = rcs.startPtr;
final int maxPos = rcs.endPtr - needleLen;
- OUTER: for (; matchPos < maxPos; matchPos++) {
+ OUTER: for (; matchPos <= maxPos; matchPos++) {
if (neq(first, text[matchPos])) {
- while (++matchPos < maxPos && neq(first, text[matchPos])) {
+ while (++matchPos <= maxPos && neq(first, text[matchPos])) {
/* skip */
}
- if (matchPos == maxPos)
+ if (matchPos > maxPos)
return -1;
}
- int si = ++matchPos;
+ int si = matchPos + 1;
for (int j = 1; j < needleLen; j++, si++) {
if (neq(needle[j], text[si]))
continue OUTER;
}
- return matchPos - 1;
+ return matchPos;
}
return -1;
}