Merge "PackIndexV2: fix possibly wrong check"

This commit is contained in:
Shawn Pearce 2014-08-28 19:53:36 -04:00 committed by Gerrit Code Review @ Eclipse.org
commit 7b28130758
1 changed files with 1 additions and 1 deletions

View File

@ -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;