summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Aniszczyk <caniszczyk@gmail.com>2010-08-25 19:52:36 -0400
committerCode Review <codereview-daemon@eclipse.org>2010-08-25 19:52:36 -0400
commitf74d474f3c6e03b82f70d2ccc92f84c070812fc5 (patch)
tree8cab0445d7e354f47f3dc11983b42a03cd4965f1
parent595a20a064f699f44a2688effd433a3db0542152 (diff)
parent7cfe2f12ff399581f9e205adc3a49bc240a3932a (diff)
downloadjgit-f74d474f3c6e03b82f70d2ccc92f84c070812fc5.tar.gz
jgit-f74d474f3c6e03b82f70d2ccc92f84c070812fc5.zip
Merge "Don't copy more than the object size"
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java
index e8a125d575..b8d7f37190 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectLoader.java
@@ -169,14 +169,14 @@ public abstract class ObjectLoader {
final long sz = in.getSize();
byte[] tmp = new byte[1024];
long copied = 0;
- for (;;) {
+ while (copied < sz) {
int n = in.read(tmp);
if (n < 0)
- break;
+ throw new EOFException();
out.write(tmp, 0, n);
copied += n;
}
- if (copied != sz)
+ if (0 <= in.read())
throw new EOFException();
} finally {
in.close();