diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV2.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV2.java index 9d2caa2e8..5a5d1f77d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV2.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV2.java @@ -116,7 +116,7 @@ class PackIndexV2 extends PackIndex { } final long nameLen = bucketCnt * Constants.OBJECT_ID_LENGTH; - if (nameLen > Integer.MAX_VALUE) + if (nameLen > Integer.MAX_VALUE - 8) // see http://stackoverflow.com/a/8381338 throw new IOException(JGitText.get().indexFileIsTooLargeForJgit); final int intNameLen = (int) nameLen;