From: Dariusz Luksza Date: Tue, 6 Sep 2011 08:12:39 +0000 (+0200) Subject: Fix IOOBE in Repository.resolveSimple() X-Git-Tag: v1.2.0.201112221803-r~88^2^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fchanges%2F64%2F4164%2F1;p=jgit.git Fix IOOBE in Repository.resolveSimple() IndexOutOfBoundException is thrown from Repository.resolveSimple() when '-g' string is located less then 4 characters from the end of this string. Change-Id: I1128c2cdfec9db3023d4d0f1f40d863e84b75950 Signed-off-by: Dariusz Luksza --- diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index b51a954ca9..3a3e1c558f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -597,7 +597,7 @@ public abstract class Repository { return resolveAbbreviation(revstr); int dashg = revstr.indexOf("-g"); - if (4 < revstr.length() && 0 <= dashg + if ((dashg + 4) < revstr.length() && 0 <= dashg && isHex(revstr.charAt(dashg + 2)) && isHex(revstr.charAt(dashg + 3)) && isAllHex(revstr, dashg + 4)) {