diff options
author | Marc Strapetz <marc.strapetz@syntevo.com> | 2014-08-15 14:00:40 +0200 |
---|---|---|
committer | Marc Strapetz <marc.strapetz@syntevo.com> | 2014-08-15 14:01:09 +0200 |
commit | ce48fba05e6b52bd234c8f4abe66d55a2c0e56df (patch) | |
tree | 3a6208b188205849554c4afca23e9df82c632fd6 | |
parent | fa5582f3fea490e56b5d7ef97501968e57d8ee64 (diff) | |
download | jgit-ce48fba05e6b52bd234c8f4abe66d55a2c0e56df.tar.gz jgit-ce48fba05e6b52bd234c8f4abe66d55a2c0e56df.zip |
PackIndexV2: fix possibly wrong check
According to http://stackoverflow.com/a/8381338, the maximum array
size is not Integer.MAX_VALUE, but Integer.MAX_VALUE - 8
Change-Id: I6ddc7470368acd20abf0885c53c89a982bb0f176
Signed-off-by: Marc Strapetz <marc.strapetz@syntevo.com>
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackIndexV2.java | 2 |
1 files changed, 1 insertions, 1 deletions
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 9d2caa2e88..5a5d1f77d9 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; |