diff options
Diffstat (limited to 'xdelta3/xdelta3.c')
-rw-r--r-- | xdelta3/xdelta3.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c index 17985ae..3a0c6e8 100644 --- a/xdelta3/xdelta3.c +++ b/xdelta3/xdelta3.c | |||
@@ -3813,7 +3813,16 @@ xd3_encode_input (xd3_stream *stream) | |||
3813 | return ret; | 3813 | return ret; |
3814 | } | 3814 | } |
3815 | 3815 | ||
3816 | stream->input_position += stream->match_fwd; | 3816 | /* The search has to make forward progress here |
3817 | * or else it can get stuck in a match-backward | ||
3818 | * (getsrcblk) then match-forward (getsrcblk), | ||
3819 | * find insufficient match length, then repeat | ||
3820 | * exactly the same search. */ | ||
3821 | if (stream->match_fwd != 0) { | ||
3822 | stream->input_position += stream->match_fwd; | ||
3823 | } else { | ||
3824 | stream->input_position += 1; | ||
3825 | } | ||
3817 | } | 3826 | } |
3818 | 3827 | ||
3819 | case MATCH_SEARCHING: | 3828 | case MATCH_SEARCHING: |
@@ -4741,7 +4750,7 @@ xd3_smatch (xd3_stream *stream, | |||
4741 | 4750 | ||
4742 | again: | 4751 | again: |
4743 | 4752 | ||
4744 | IF_DEBUG1 (DP(RINT "smatch at base=%u inp=%u cksum=%u\n", base, | 4753 | IF_DEBUG2 (DP(RINT "smatch at base=%u inp=%u cksum=%u\n", base, |
4745 | stream->input_position, scksum)); | 4754 | stream->input_position, scksum)); |
4746 | 4755 | ||
4747 | /* For small matches, we can always go to the end-of-input because | 4756 | /* For small matches, we can always go to the end-of-input because |