summaryrefslogtreecommitdiff
path: root/xdelta3/xdelta3.c
diff options
context:
space:
mode:
authorjosh.macdonald <jmacd@users.noreply.github.com>2008-04-15 04:01:06 +0000
committerjosh.macdonald <jmacd@users.noreply.github.com>2008-04-15 04:01:06 +0000
commit13a3797683e06fc55c5e19415fe70d0caef53f08 (patch)
tree38a5769518ba9d7774204114d0a8a8b1ec59d2d9 /xdelta3/xdelta3.c
parenta5fcf7340127e5f55b7cec9af06dcf2386d2dbdb (diff)
Fixes for issue 70. The test inputs tickled a case where the
non-blocking API would not make progress, searching for match on the page boundary and repeatedly asking the application to get another source block. This is only a non-blocking issue, glad it's fixed. I'll add encode_decode_test to my test suite before another release.
Diffstat (limited to 'xdelta3/xdelta3.c')
-rw-r--r--xdelta3/xdelta3.c13
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