diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2019-09-23 12:41:35 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2019-09-23 13:17:23 +0200 |
commit | 97deff8278c8bed1ec448b9c30b8999c6a62fe03 (patch) | |
tree | 65c8184cc66936a073c61e03a0d3412edac3c704 /searchlib/src | |
parent | 4d00bb40718ab4e01230e1492d73a2d92e0124f9 (diff) |
Detect enum store entry reference count overflow.
Diffstat (limited to 'searchlib/src')
3 files changed, 3 insertions, 0 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/enumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/enumattribute.hpp index 897d8a10ec6..b527f89b224 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/enumattribute.hpp @@ -41,6 +41,7 @@ void EnumAttribute<B>::load_enum_store(LoadedVector& loaded) prev = value.getValue(); prevRefCount = 1; } else { + assert(prevRefCount < std::numeric_limits<uint32_t>::max()); prevRefCount++; } value.setEidx(index); diff --git a/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.h b/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.h index a8d6fc3ba68..275fadd1e7f 100644 --- a/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.h +++ b/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.h @@ -138,6 +138,7 @@ public: (void) docId; (void) weight; assert(e < _hist.size()); + assert(_hist[e] < std::numeric_limits<uint32_t>::max()); ++_hist[e]; } }; diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp index 21bbec729df..19ef92c9356 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp @@ -93,6 +93,7 @@ PostingListAttributeBase<P>::handle_load_posting_lists_and_update_enum_store(enu postings.clear(); } } + assert(refCount < std::numeric_limits<uint32_t>::max()); ++refCount; assert(elem.getDocId() < docIdLimit); (void) docIdLimit; |