summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorMarc Strapetz <marc.strapetz@syntevo.com>2016-08-22 09:53:18 +0200
committerDavid Pursehouse <david.pursehouse@gmail.com>2016-10-21 18:13:04 +0900
commitc6459a6167b72039f94f05c00566ce7a324ec23a (patch)
tree776518301457812dc77daca43b2c9d37f2cb1fa8 /org.eclipse.jgit
parent4ab06388adcf5fc9a5405c8bb80dda8f5cdaa421 (diff)
downloadjgit-c6459a6167b72039f94f05c00566ce7a324ec23a.tar.gz
jgit-c6459a6167b72039f94f05c00566ce7a324ec23a.zip
Fix possible SIOOBE in RefDirectory.parsePackedRefs
This SIOOBE happens reproducibly when trying to access a repository containing Cygwin symlinks Change-Id: I25f103fcc723bac7bfaaeee333a86f11627a92c7 Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java1
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java5
3 files changed, 7 insertions, 0 deletions
diff --git a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
index 5f420ab18f..399436dfaa 100644
--- a/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
+++ b/org.eclipse.jgit/resources/org/eclipse/jgit/internal/JGitText.properties
@@ -465,6 +465,7 @@ packDoesNotMatchIndex=Pack {0} does not match index
packedRefsHandleIsStale=packed-refs handle is stale, {0}. retry
packetSizeMustBeAtLeast=packet size {0} must be >= {1}
packetSizeMustBeAtMost=packet size {0} must be <= {1}
+packedRefsCorruptionDetected=packed-refs corruption detected: {0}
packfileCorruptionDetected=Packfile corruption detected: {0}
packFileInvalid=Pack file invalid: {0}
packfileIsTruncated=Packfile {0} is truncated.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
index e920554a48..00d019184d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/JGitText.java
@@ -524,6 +524,7 @@ public class JGitText extends TranslationBundle {
/***/ public String packedRefsHandleIsStale;
/***/ public String packetSizeMustBeAtLeast;
/***/ public String packetSizeMustBeAtMost;
+ /***/ public String packedRefsCorruptionDetected;
/***/ public String packfileCorruptionDetected;
/***/ public String packFileInvalid;
/***/ public String packfileIsTruncated;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
index 108065913a..e3d0d6162c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
@@ -843,6 +843,11 @@ public class RefDirectory extends RefDatabase {
}
int sp = p.indexOf(' ');
+ if (sp < 0) {
+ throw new IOException(MessageFormat.format(
+ JGitText.get().packedRefsCorruptionDetected,
+ packedRefsFile.getAbsolutePath()));
+ }
ObjectId id = ObjectId.fromString(p.substring(0, sp));
String name = copy(p, sp + 1, p.length());
ObjectIdRef cur;