From c5884f221e281b0fa52c5e71f9329813ec9cea48 Mon Sep 17 00:00:00 2001 From: Joshua MacDonald Date: Thu, 19 Nov 2015 23:17:28 -0800 Subject: Stress testing w/ [64bithash]/.../go/src/regtest.go --- xdelta3/xdelta3-decode.h | 6 +++--- xdelta3/xdelta3.c | 14 +++++++++----- 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, } IF_DEBUG2 (DP(RINT "[xd3_decode_section] take %u @ %u[%u] size %u\n", - section->pos, sect_take, section->alloc1, section->size)); - - XD3_ASSERT (section->pos + sect_take < section->alloc1); + sect_take, section->pos, section->alloc1, section->size)); + XD3_ASSERT (section->pos + sect_take <= section->alloc1); memcpy (section->copied1 + section->pos, stream->next_in, @@ -249,6 +248,7 @@ xd3_decode_section (xd3_stream *stream, if (section->pos < section->size) { + IF_DEBUG1 (DP(RINT "[xd3_decode_section] further input required %u\n", section->size - section->pos)); stream->msg = "further input required"; return XD3_INPUT; } 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) if (srcpos < stream->srcwin_cksum_pos && stream->srcwin_cksum_pos - srcpos > src->max_winsize) { - IF_DEBUG2(DP(RINT "[match_setup] rejected due to src->max_winsize " + IF_DEBUG1(DP(RINT "[match_setup] rejected due to src->max_winsize " "distance eof=%"Q"u srcpos=%"Q"u max_winsz=%"Q"u\n", xd3_source_eof (src), srcpos, src->max_winsize)); @@ -3866,6 +3866,7 @@ xd3_source_match_setup (xd3_stream *stream, xoff_t srcpos) bad: stream->match_state = MATCH_SEARCHING; + stream->match_last_srcpos = srcpos; return 1; } @@ -3956,16 +3957,18 @@ xd3_source_extend_match (xd3_stream *stream) { if (ret == XD3_TOOFARBACK) { - IF_DEBUG1(DP(RINT "[maxback] frontier block %u TOOFARBACK block %u\n", - stream->src->frontier_pos >> stream->src->shiftby, tryblk)); + IF_DEBUG1(DP(RINT "[maxback] %"Q"u TOOFARBACK: %u\n", + tryblk, stream->match_back)); + /* the starting position is too far back. */ if (stream->match_back == 0) { - return 0; + XD3_ASSERT(stream->match_fwd == 0); + goto donefwd; } /* search went too far back, continue forward. */ - break; + goto doneback; } /* could be a XD3_GETSRCBLK failure. */ @@ -4042,6 +4045,7 @@ xd3_source_extend_match (xd3_stream *stream) } } + donefwd: stream->match_state = MATCH_SEARCHING; /* If the match ends short of the last instruction end, we probably -- cgit v1.2.3