summaryrefslogtreecommitdiff
path: root/xdelta3
diff options
context:
space:
mode:
Diffstat (limited to 'xdelta3')
-rw-r--r--xdelta3/xdelta3-decode.h6
-rw-r--r--xdelta3/xdelta3.c14
2 files changed, 12 insertions, 8 deletions
diff --git a/xdelta3/xdelta3-decode.h b/xdelta3/xdelta3-decode.h
index 6b3815f..3266425 100644
--- a/xdelta3/xdelta3-decode.h
+++ b/xdelta3/xdelta3-decode.h
@@ -231,9 +231,8 @@ xd3_decode_section (xd3_stream *stream,
231 } 231 }
232 232
233 IF_DEBUG2 (DP(RINT "[xd3_decode_section] take %u @ %u[%u] size %u\n", 233 IF_DEBUG2 (DP(RINT "[xd3_decode_section] take %u @ %u[%u] size %u\n",
234 section->pos, sect_take, section->alloc1, section->size)); 234 sect_take, section->pos, section->alloc1, section->size));
235 235 XD3_ASSERT (section->pos + sect_take <= section->alloc1);
236 XD3_ASSERT (section->pos + sect_take < section->alloc1);
237 236
238 memcpy (section->copied1 + section->pos, 237 memcpy (section->copied1 + section->pos,
239 stream->next_in, 238 stream->next_in,
@@ -249,6 +248,7 @@ xd3_decode_section (xd3_stream *stream,
249 248
250 if (section->pos < section->size) 249 if (section->pos < section->size)
251 { 250 {
251 IF_DEBUG1 (DP(RINT "[xd3_decode_section] further input required %u\n", section->size - section->pos));
252 stream->msg = "further input required"; 252 stream->msg = "further input required";
253 return XD3_INPUT; 253 return XD3_INPUT;
254 } 254 }
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c
index 2264e8e..8dc43e0 100644
--- a/xdelta3/xdelta3.c
+++ b/xdelta3/xdelta3.c
@@ -3750,7 +3750,7 @@ xd3_source_match_setup (xd3_stream *stream, xoff_t srcpos)
3750 if (srcpos < stream->srcwin_cksum_pos && 3750 if (srcpos < stream->srcwin_cksum_pos &&
3751 stream->srcwin_cksum_pos - srcpos > src->max_winsize) 3751 stream->srcwin_cksum_pos - srcpos > src->max_winsize)
3752 { 3752 {
3753 IF_DEBUG2(DP(RINT "[match_setup] rejected due to src->max_winsize " 3753 IF_DEBUG1(DP(RINT "[match_setup] rejected due to src->max_winsize "
3754 "distance eof=%"Q"u srcpos=%"Q"u max_winsz=%"Q"u\n", 3754 "distance eof=%"Q"u srcpos=%"Q"u max_winsz=%"Q"u\n",
3755 xd3_source_eof (src), 3755 xd3_source_eof (src),
3756 srcpos, src->max_winsize)); 3756 srcpos, src->max_winsize));
@@ -3866,6 +3866,7 @@ xd3_source_match_setup (xd3_stream *stream, xoff_t srcpos)
3866 3866
3867 bad: 3867 bad:
3868 stream->match_state = MATCH_SEARCHING; 3868 stream->match_state = MATCH_SEARCHING;
3869 stream->match_last_srcpos = srcpos;
3869 return 1; 3870 return 1;
3870} 3871}
3871 3872
@@ -3956,16 +3957,18 @@ xd3_source_extend_match (xd3_stream *stream)
3956 { 3957 {
3957 if (ret == XD3_TOOFARBACK) 3958 if (ret == XD3_TOOFARBACK)
3958 { 3959 {
3959 IF_DEBUG1(DP(RINT "[maxback] frontier block %u TOOFARBACK block %u\n", 3960 IF_DEBUG1(DP(RINT "[maxback] %"Q"u TOOFARBACK: %u\n",
3960 stream->src->frontier_pos >> stream->src->shiftby, tryblk)); 3961 tryblk, stream->match_back));
3962
3961 /* the starting position is too far back. */ 3963 /* the starting position is too far back. */
3962 if (stream->match_back == 0) 3964 if (stream->match_back == 0)
3963 { 3965 {
3964 return 0; 3966 XD3_ASSERT(stream->match_fwd == 0);
3967 goto donefwd;
3965 } 3968 }
3966 3969
3967 /* search went too far back, continue forward. */ 3970 /* search went too far back, continue forward. */
3968 break; 3971 goto doneback;
3969 } 3972 }
3970 3973
3971 /* could be a XD3_GETSRCBLK failure. */ 3974 /* could be a XD3_GETSRCBLK failure. */
@@ -4042,6 +4045,7 @@ xd3_source_extend_match (xd3_stream *stream)
4042 } 4045 }
4043 } 4046 }
4044 4047
4048 donefwd:
4045 stream->match_state = MATCH_SEARCHING; 4049 stream->match_state = MATCH_SEARCHING;
4046 4050
4047 /* If the match ends short of the last instruction end, we probably 4051 /* If the match ends short of the last instruction end, we probably