aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/tensor/tensor_buffer_store.cpp
diff options
context:
space:
mode:
authorGeir Storli <geirst@yahooinc.com>2022-10-09 20:12:34 +0200
committerGitHub <noreply@github.com>2022-10-09 20:12:34 +0200
commit240a62de8a9b3c93fb9f7031f5e204264d414817 (patch)
tree1f5e0bb204f8a98d7bf8fdf0da48472de27a3ab8 /searchlib/src/vespa/searchlib/tensor/tensor_buffer_store.cpp
parent14e1b2febd40c3fa89d09b64569b4634f5594acc (diff)
parenta45d929b88b17c9de0d53d4c6fc3b25815bbe233 (diff)
Merge pull request #24367 from vespa-engine/toregge/share-code-for-loading-and-saving-tensor-attributev8.65.41
Share code for loading and saving tensor attribute between
Diffstat (limited to 'searchlib/src/vespa/searchlib/tensor/tensor_buffer_store.cpp')
-rw-r--r--searchlib/src/vespa/searchlib/tensor/tensor_buffer_store.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_buffer_store.cpp b/searchlib/src/vespa/searchlib/tensor/tensor_buffer_store.cpp
index eff6ac9f374..800311adfd6 100644
--- a/searchlib/src/vespa/searchlib/tensor/tensor_buffer_store.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/tensor_buffer_store.cpp
@@ -1,6 +1,7 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "tensor_buffer_store.h"
+#include <vespa/document/util/serializableexceptions.h>
#include <vespa/eval/eval/value_codec.h>
#include <vespa/eval/streamed/streamed_value_builder_factory.h>
#include <vespa/vespalib/datastore/array_store.hpp>
@@ -10,6 +11,7 @@
#include <vespa/vespalib/datastore/datastore.hpp>
#include <vespa/vespalib/util/size_literals.h>
+using document::DeserializeException;
using vespalib::alloc::MemoryAllocator;
using vespalib::datastore::CompactionContext;
using vespalib::datastore::CompactionStrategy;
@@ -90,6 +92,9 @@ TensorBufferStore::store_encoded_tensor(vespalib::nbostream &encoded)
{
const auto &factory = StreamedValueBuilderFactory::get();
auto val = vespalib::eval::decode_value(encoded, factory);
+ if (!encoded.empty()) {
+ throw DeserializeException("Leftover bytes deserializing tensor attribute value.", VESPA_STRLOC);
+ }
return store_tensor(*val);
}