From: Nick Terrell Date: Mon, 21 Aug 2017 20:30:07 +0000 (-0700) Subject: [cover] Convert score to U32 and check for zero X-Git-Tag: fuzz-corpora2~47^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a54a315aa28a6659b935bd6ce95cb962715ebbc;p=thirdparty%2Fzstd.git [cover] Convert score to U32 and check for zero --- diff --git a/lib/dictBuilder/cover.c b/lib/dictBuilder/cover.c index 501b5b490..07fedc2d1 100644 --- a/lib/dictBuilder/cover.c +++ b/lib/dictBuilder/cover.c @@ -382,7 +382,7 @@ static void COVER_group(COVER_ctx_t *ctx, const void *group, typedef struct { U32 begin; U32 end; - double score; + U32 score; } COVER_segment_t; /** @@ -622,6 +622,10 @@ static size_t COVER_buildDictionary(const COVER_ctx_t *ctx, U32 *freqs, /* Select a segment */ COVER_segment_t segment = COVER_selectSegment( ctx, freqs, activeDmers, epochBegin, epochEnd, parameters); + /* If the segment covers no dmers, then we are out of content */ + if (segment.score == 0) { + break; + } /* Trim the segment if necessary and if it is too small then we are done */ segmentSize = MIN(segment.end - segment.begin + parameters.d - 1, tail); if (segmentSize < parameters.d) {