diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2021-02-12 12:28:36 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2021-02-12 12:28:36 +0100 |
commit | 189f3f7675e2979c32df56ab98085ffc3aa3643b (patch) | |
tree | 5c3cef214042942ee2532a1a0d6c4f481b4827f2 /searchlib | |
parent | 441466a5010a7e580e6e81e541244fb7bc6e75c9 (diff) |
Add comments.
Diffstat (limited to 'searchlib')
3 files changed, 3 insertions, 0 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h index ebcf3b821b7..cb803735b89 100644 --- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h +++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h @@ -41,6 +41,7 @@ protected: protected: uint32_t getTargetLid(uint32_t lid) const { + // Check range to avoid reading memory beyond end of mapping array return lid < _targetLids.size() ? _targetLids[lid] : 0u; } diff --git a/searchlib/src/vespa/searchlib/attribute/imported_search_context.h b/searchlib/src/vespa/searchlib/attribute/imported_search_context.h index a37774476e0..caf9b2f3c11 100644 --- a/searchlib/src/vespa/searchlib/attribute/imported_search_context.h +++ b/searchlib/src/vespa/searchlib/attribute/imported_search_context.h @@ -40,6 +40,7 @@ class ImportedSearchContext : public ISearchContext { SearchContextParams _params; uint32_t getTargetLid(uint32_t lid) const { + // Check range to avoid reading memory beyond end of mapping array return lid < _targetLids.size() ? _targetLids[lid] : 0u; } diff --git a/searchlib/src/vespa/searchlib/attribute/reference_mappings.h b/searchlib/src/vespa/searchlib/attribute/reference_mappings.h index 971ef1eaf93..84dea276740 100644 --- a/searchlib/src/vespa/searchlib/attribute/reference_mappings.h +++ b/searchlib/src/vespa/searchlib/attribute/reference_mappings.h @@ -87,6 +87,7 @@ public: return TargetLids(&_targetLids[0], committedDocIdLimit); } uint32_t getTargetLid(uint32_t doc) const { + // Check limit to avoid reading memory beyond end of valid mapping array return doc < _committedDocIdLimit ? _targetLids[doc] : 0u; } ReverseMappingRefs getReverseMappingRefs() const { |