aboutsummaryrefslogtreecommitdiffstats
path: root/searchsummary
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2020-02-20 13:13:05 +0100
committerTor Egge <Tor.Egge@broadpark.no>2020-02-20 13:13:05 +0100
commit347a07fea2030319051ad78bd1c87390d9c2a50f (patch)
treeabfe74a236d122480749fb0734feed89303c3230 /searchsummary
parent769784afbc958ca051f3ad8c6983749c41c31854 (diff)
Guard against out of bounds stale matching element.
Diffstat (limited to 'searchsummary')
-rw-r--r--searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp b/searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp
index 7368a199569..ada14bf17f5 100644
--- a/searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp
+++ b/searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp
@@ -389,9 +389,11 @@ private:
MapFieldValueInserter map_inserter(_inserter, _tokenize);
if (filter_matching_elements()) {
assert(v.has_no_erased_keys());
- for (uint32_t id_to_keep : (*_matching_elems)) {
- auto entry = v[id_to_keep];
- map_inserter.insert_entry(*entry.first, *entry.second);
+ if (!_matching_elems->empty() && _matching_elems->back() < v.size()) {
+ for (uint32_t id_to_keep : (*_matching_elems)) {
+ auto entry = v[id_to_keep];
+ map_inserter.insert_entry(*entry.first, *entry.second);
+ }
}
} else {
for (const auto &entry : v) {
@@ -406,8 +408,10 @@ private:
ArrayInserter ai(a);
SlimeFiller conv(ai, _tokenize);
if (filter_matching_elements()) {
- for (uint32_t id_to_keep : (*_matching_elems)) {
- value[id_to_keep].accept(conv);
+ if (!_matching_elems->empty() && _matching_elems->back() < value.size()) {
+ for (uint32_t id_to_keep : (*_matching_elems)) {
+ value[id_to_keep].accept(conv);
+ }
}
} else {
for (const FieldValue &fv : value) {