summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3.c
diff options
context:
space:
mode:
authorjosh.macdonald <jmacd@users.noreply.github.com>2010-02-16 05:15:49 +0000
committerjosh.macdonald <jmacd@users.noreply.github.com>2010-02-16 05:15:49 +0000
commit2410f9aa90750bc4c9892ae631a48cb4089a4e46 (patch)
treedac6b16568871ffe39be2a8f512964aa4a7e9eee /xdelta3/xdelta3.c
parent1f7cebdc141c0bae5c25201e35b4d8fd2a27bb16 (diff)
Fixes a memory corruption caused by recent changes (as early as 3.0w,
it seems).
Diffstat (limited to 'xdelta3/xdelta3.c')
-rw-r--r--xdelta3/xdelta3.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c
index 20bffdb..4f91318 100644
--- a/xdelta3/xdelta3.c
+++ b/xdelta3/xdelta3.c
@@ -3798,7 +3798,8 @@ xd3_encode_input (xd3_stream *stream)
3798 3798
3799 case ENC_SEARCH: 3799 case ENC_SEARCH:
3800 IF_DEBUG2 (DP(RINT "[SEARCH] match_state %d avail_in %u %s\n", 3800 IF_DEBUG2 (DP(RINT "[SEARCH] match_state %d avail_in %u %s\n",
3801 stream->match_state, stream->avail_in, stream->src ? "source" : "no source")); 3801 stream->match_state, stream->avail_in,
3802 stream->src ? "source" : "no source"));
3802 3803
3803 /* Reentrant matching. */ 3804 /* Reentrant matching. */
3804 if (stream->src != NULL) 3805 if (stream->src != NULL)
@@ -4368,14 +4369,13 @@ xd3_source_match_setup (xd3_stream *stream, xoff_t srcpos)
4368 /* Implement srcwin_maxsz, which prevents the encoder from seeking 4369 /* Implement srcwin_maxsz, which prevents the encoder from seeking
4369 * back further than the LRU cache maintaining FIFO discipline, (to 4370 * back further than the LRU cache maintaining FIFO discipline, (to
4370 * avoid seeking). */ 4371 * avoid seeking). */
4371 frontier_pos = stream->src->eof_known ? 4372 frontier_pos =
4372 xd3_source_eof (stream->src) : 4373 stream->src->frontier_blkno * stream->src->blksize;
4373 (stream->src->frontier_blkno * stream->src->blksize);
4374 IF_DEBUG1(DP(RINT "[match_setup] frontier_pos %"Q"u, srcpos %"Q"u, " 4374 IF_DEBUG1(DP(RINT "[match_setup] frontier_pos %"Q"u, srcpos %"Q"u, "
4375 "srcwin_maxsz %u\n", 4375 "srcwin_maxsz %u\n",
4376 frontier_pos, srcpos, stream->srcwin_maxsz)); 4376 frontier_pos, srcpos, stream->srcwin_maxsz));
4377 XD3_ASSERT (frontier_pos >= srcpos); 4377 if (srcpos < frontier_pos &&
4378 if (frontier_pos - srcpos > stream->srcwin_maxsz) { 4378 frontier_pos - srcpos > stream->srcwin_maxsz) {
4379 IF_DEBUG1(DP(RINT "[match_setup] rejected due to srcwin_maxsz " 4379 IF_DEBUG1(DP(RINT "[match_setup] rejected due to srcwin_maxsz "
4380 "distance eof=%"Q"u srcpos=%"Q"u maxsz=%u\n", 4380 "distance eof=%"Q"u srcpos=%"Q"u maxsz=%u\n",
4381 xd3_source_eof (stream->src), 4381 xd3_source_eof (stream->src),