From 4522b07d0f78174d632a3159a553f1e4c78c8408 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sun, 10 Oct 2010 18:48:15 -0700 Subject: [PATCH] Fix corrupted large deltas Large objects stored as deltas get unpacked by JGit into a loose object, so they are cheaper to access later on. This unpacking was broken because TeeInputStream copied the wrong length into the loose object, sometimes copying too many bytes into the result. This created a loose object that did not have the correct content, and whose length did not match the length denoted in the object header. Change-Id: I3ce1fd9f3dc5bd195249c7872b3bec49570424a2 Signed-off-by: Shawn O. Pearce --- .../src/org/eclipse/jgit/util/io/TeeInputStream.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TeeInputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TeeInputStream.java index 9d036595f9..16ed9c6eb9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TeeInputStream.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/TeeInputStream.java @@ -110,7 +110,7 @@ public class TeeInputStream extends InputStream { int n = src.read(b, off, len); if (0 < n) - dst.write(b, off, len); + dst.write(b, off, n); return n; } -- 2.39.5