summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjosh.macdonald <jmacd@users.noreply.github.com>2012-11-13 02:15:07 +0000
committerjosh.macdonald <jmacd@users.noreply.github.com>2012-11-13 02:15:07 +0000
commit95250a1edb606539ef2a84b97f15fcf9ca7f045d (patch)
treea659c884f214b578de35fb7681bd3183b8b4c7b5
parentcf7a6661699ee81be37b5866744440f2e4ebbd55 (diff)
Fix an off-by-one error in preventing > max_srcwinsize backward seeks
-rw-r--r--xdelta3/xdelta3-blkcache.h2
-rw-r--r--xdelta3/xdelta3.c7
2 files changed, 6 insertions, 3 deletions
diff --git a/xdelta3/xdelta3-blkcache.h b/xdelta3/xdelta3-blkcache.h
index 46a6a6e..56b8973 100644
--- a/xdelta3/xdelta3-blkcache.h
+++ b/xdelta3/xdelta3-blkcache.h
@@ -384,7 +384,7 @@ main_read_seek_source (xd3_stream *stream,
384 384
385 sfile->seek_failed = 1; 385 sfile->seek_failed = 1;
386 386
387 if (option_verbose > 1) 387 if (option_verbose > 1 && pos != sfile->source_position)
388 { 388 {
389 XPR(NT "non-seekable source skipping %"Q"u bytes @ %"Q"u\n", 389 XPR(NT "non-seekable source skipping %"Q"u bytes @ %"Q"u\n",
390 pos - sfile->source_position, 390 pos - sfile->source_position,
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c
index b7baa65..431bab9 100644
--- a/xdelta3/xdelta3.c
+++ b/xdelta3/xdelta3.c
@@ -4421,9 +4421,12 @@ xd3_source_match_setup (xd3_stream *stream, xoff_t srcpos)
4421 4421
4422 /* Implement srcwin_maxsz, which prevents the encoder from seeking 4422 /* Implement srcwin_maxsz, which prevents the encoder from seeking
4423 * back further than the LRU cache maintaining FIFO discipline, (to 4423 * back further than the LRU cache maintaining FIFO discipline, (to
4424 * avoid seeking). */ 4424 * avoid seeking). Note the +1 here ensures that "frontier_pos" is
4425 * the address of the next byte in the stream, and ensures that the
4426 * maximum offset is less than the source window size (in
4427 * blocks). */
4425 frontier_pos = 4428 frontier_pos =
4426 stream->src->frontier_blkno * stream->src->blksize; 4429 (stream->src->frontier_blkno +1) * stream->src->blksize;
4427 IF_DEBUG1(DP(RINT "[match_setup] frontier_pos %"Q"u, srcpos %"Q"u, " 4430 IF_DEBUG1(DP(RINT "[match_setup] frontier_pos %"Q"u, srcpos %"Q"u, "
4428 "srcwin_maxsz %u\n", 4431 "srcwin_maxsz %u\n",
4429 frontier_pos, srcpos, stream->srcwin_maxsz)); 4432 frontier_pos, srcpos, stream->srcwin_maxsz));