diff options
Diffstat (limited to 'xdelta3/xdelta3.c')
-rw-r--r-- | xdelta3/xdelta3.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/xdelta3/xdelta3.c b/xdelta3/xdelta3.c index 95ff509..51d24de 100644 --- a/xdelta3/xdelta3.c +++ b/xdelta3/xdelta3.c | |||
@@ -1104,7 +1104,17 @@ xd3_round_blksize (usize_t sz, usize_t blksz) | |||
1104 | 1104 | ||
1105 | XD3_ASSERT (xd3_check_pow2 (blksz, NULL) == 0); | 1105 | XD3_ASSERT (xd3_check_pow2 (blksz, NULL) == 0); |
1106 | 1106 | ||
1107 | return mod ? (sz + (blksz - mod)) : sz; | 1107 | if (mod == 0) |
1108 | { | ||
1109 | return sz; | ||
1110 | } | ||
1111 | |||
1112 | if (sz > USIZE_T_MAXBLKSZ) | ||
1113 | { | ||
1114 | return USIZE_T_MAXBLKSZ; | ||
1115 | } | ||
1116 | |||
1117 | return sz + (blksz - mod); | ||
1108 | } | 1118 | } |
1109 | 1119 | ||
1110 | /*********************************************************************** | 1120 | /*********************************************************************** |
@@ -2081,8 +2091,8 @@ xd3_close_stream (xd3_stream *stream) | |||
2081 | break; | 2091 | break; |
2082 | default: | 2092 | default: |
2083 | /* If decoding, should be ready for the next window. */ | 2093 | /* If decoding, should be ready for the next window. */ |
2084 | stream->msg = "EOF in decode"; | 2094 | stream->msg = "eof in decode"; |
2085 | return XD3_INTERNAL; | 2095 | return XD3_INVALID_INPUT; |
2086 | } | 2096 | } |
2087 | } | 2097 | } |
2088 | 2098 | ||
@@ -3762,7 +3772,7 @@ xd3_source_match_setup (xd3_stream *stream, xoff_t srcpos) | |||
3762 | frontier_pos, srcpos, stream->src->max_winsize)); | 3772 | frontier_pos, srcpos, stream->src->max_winsize)); |
3763 | if (srcpos < frontier_pos && | 3773 | if (srcpos < frontier_pos && |
3764 | frontier_pos - srcpos > stream->src->max_winsize) { | 3774 | frontier_pos - srcpos > stream->src->max_winsize) { |
3765 | IF_DEBUG1(DP(RINT "[match_setup] rejected due to src->max_winsize " | 3775 | IF_DEBUG2(DP(RINT "[match_setup] rejected due to src->max_winsize " |
3766 | "distance eof=%"Q"u srcpos=%"Q"u maxsz=%"Q"u\n", | 3776 | "distance eof=%"Q"u srcpos=%"Q"u maxsz=%"Q"u\n", |
3767 | xd3_source_eof (stream->src), | 3777 | xd3_source_eof (stream->src), |
3768 | srcpos, stream->src->max_winsize)); | 3778 | srcpos, stream->src->max_winsize)); |
@@ -4423,14 +4433,15 @@ xd3_srcwin_move_point (xd3_stream *stream, usize_t *next_move_point) | |||
4423 | IF_DEBUG1 (DP(RINT | 4433 | IF_DEBUG1 (DP(RINT |
4424 | "[srcwin_move_point] async getblk return for %"Q"u\n", | 4434 | "[srcwin_move_point] async getblk return for %"Q"u\n", |
4425 | blkno)); | 4435 | blkno)); |
4436 | |||
4426 | return ret; | 4437 | return ret; |
4427 | } | 4438 | } |
4428 | 4439 | ||
4429 | IF_DEBUG1 (DP(RINT | 4440 | IF_DEBUG1 (DP(RINT |
4430 | "[srcwin_move_point] T=%"Q"u{%"Q"u} S=%"Q"u EOF=%"Q"u %s\n", | 4441 | "[srcwin_move_point] T=%"Q"u S=%"Q"u L=%"Q"u EOF=%"Q"u %s\n", |
4431 | stream->total_in + stream->input_position, | 4442 | stream->total_in + stream->input_position, |
4432 | logical_input_cksum_pos, | ||
4433 | stream->srcwin_cksum_pos, | 4443 | stream->srcwin_cksum_pos, |
4444 | logical_input_cksum_pos, | ||
4434 | xd3_source_eof (stream->src), | 4445 | xd3_source_eof (stream->src), |
4435 | stream->src->eof_known ? "known" : "unknown")); | 4446 | stream->src->eof_known ? "known" : "unknown")); |
4436 | 4447 | ||
@@ -4475,11 +4486,11 @@ xd3_srcwin_move_point (xd3_stream *stream, usize_t *next_move_point) | |||
4475 | } | 4486 | } |
4476 | 4487 | ||
4477 | IF_DEBUG1 (DP(RINT | 4488 | IF_DEBUG1 (DP(RINT |
4478 | "[srcwin_move_point] exited loop T=%"Q"u{%"Q"u} " | 4489 | "[srcwin_move_point] exited loop T=%"Q"u " |
4479 | "S=%"Q"u EOF=%"Q"u %s\n", | 4490 | "S=%"Q"u L=%"Q" EOF=%"Q"u %s\n", |
4480 | stream->total_in + stream->input_position, | 4491 | stream->total_in + stream->input_position, |
4481 | logical_input_cksum_pos, | ||
4482 | stream->srcwin_cksum_pos, | 4492 | stream->srcwin_cksum_pos, |
4493 | logical_input_cksum_pos, | ||
4483 | xd3_source_eof (stream->src), | 4494 | xd3_source_eof (stream->src), |
4484 | stream->src->eof_known ? "known" : "unknown")); | 4495 | stream->src->eof_known ? "known" : "unknown")); |
4485 | 4496 | ||