]> source.dussan.org Git - jgit.git/commit
DeltaStream: Fix data corruption when reading large copies 43/1543/1
authorShawn O. Pearce <spearce@spearce.org>
Mon, 6 Sep 2010 17:06:37 +0000 (10:06 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Mon, 6 Sep 2010 17:09:12 +0000 (10:09 -0700)
commit741659fed4e73b71693b408e137804b17e65f0cb
tree62ba536cff5cf6697091a8f8f0d3b661ed16484c
parent693f454e71df226fd72e996bb28fca6640ed5dc5
DeltaStream: Fix data corruption when reading large copies

If the copy instruction was larger than the input buffer given to us,
we copied the wrong part of the base stream during the next read().

This occurred on really big binary files where a copy instruction
of 64k wasn't unreasonable, but the caller's buffer was only 8192
bytes long.  We copied the first 8192 bytes correctly, but then
reseeked the base stream back to the start of the copy region on
the second read of 8192 bytes.  Instead of a sequence like ABCD
being read into the caller, we read AAAA.

Change-Id: I240a3f722a3eda1ce8ef5db93b380e3bceb1e201
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/pack/DeltaStreamTest.java
org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/DeltaStream.java