From 428d31efd305b08e83dbd9fdd895d18dc232c295 Mon Sep 17 00:00:00 2001 From: Andrey Loskutov Date: Tue, 6 Jan 2015 14:33:07 +0100 Subject: AIOOB in ChangeIdUtil.indexOfChangeId if amended message is a newline Bug: 456792 Change-Id: Idf38a0db7dc72d672ff185dcac2f41f0012a6673 Signed-off-by: Andrey Loskutov --- org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'org.eclipse.jgit') diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java index 676ca9b8dc..35850dcaac 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/ChangeIdUtil.java @@ -229,6 +229,8 @@ public class ChangeIdUtil { */ public static int indexOfChangeId(String message, String delimiter) { String[] lines = message.split(delimiter); + if (lines.length == 0) + return -1; int indexOfChangeIdLine = 0; boolean inFooter = false; for (int i = lines.length - 1; i >= 0; --i) { -- cgit v1.2.3