aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/archive/models_archive_reader.cpp
diff options
context:
space:
mode:
authorswarmer <swarmer@yandex-team.com>2024-02-11 22:08:52 +0300
committerDaniil Cherednik <dcherednik@ydb.tech>2024-02-14 14:26:02 +0000
commit92efa0adbb25f74c0eac17404290b1df61643c2d (patch)
treeaa8117b2e29d61e27eba3b3317e9a4336bf50f91 /library/cpp/archive/models_archive_reader.cpp
parent79c83250e10e57d403e60ebcd1c2931005ef8914 (diff)
downloadydb-92efa0adbb25f74c0eac17404290b1df61643c2d.tar.gz
fix use-after-free in the IModelsArchiveReader class
The implementation has also been moved into a cpp file.
Diffstat (limited to 'library/cpp/archive/models_archive_reader.cpp')
-rw-r--r--library/cpp/archive/models_archive_reader.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/library/cpp/archive/models_archive_reader.cpp b/library/cpp/archive/models_archive_reader.cpp
new file mode 100644
index 0000000000..abbb91d628
--- /dev/null
+++ b/library/cpp/archive/models_archive_reader.cpp
@@ -0,0 +1,15 @@
+#include "models_archive_reader.h"
+
+#include <util/generic/hash_set.h>
+
+THashSet<TStringBuf> IModelsArchiveReader::FilterByPrefix(TStringBuf prefix, TStringBuf suffix) const {
+ THashSet<TStringBuf> result;
+ const size_t count = Count();
+ for (size_t ind = 0; ind < count; ++ind) {
+ TString path = KeyByIndex(ind);
+ if (path.StartsWith(prefix) && path.EndsWith(suffix)) {
+ result.insert(std::move(path));
+ }
+ }
+ return result;
+}