From 95fe8ef70a068ed480585888f68401eda2ab5fc4 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 6 Feb 2018 12:54:14 +0100 Subject: Prevent underflow due to returning endid --- searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'searchcore') diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp index 4822dc57669..c1c4387cf41 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp @@ -180,7 +180,7 @@ MatchThread::match_loop(MatchTools &tools, HitCollector &hits) { uint32_t lastCovered = inner_match_loop(context, tools, docid_range); softDoomed = (lastCovered < docid_range.end); - docsCovered += lastCovered - docid_range.begin; + docsCovered += std::min(lastCovered, docid_range.end) - docid_range.begin; } uint32_t matches = context.matches; if (do_limit && context.isBelowLimit()) { -- cgit v1.2.3