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
committerswarmer <swarmer@yandex-team.com>2024-02-11 22:23:05 +0300
commitdb26b26fad338fdc3b6b326374b9a53b1c75dd7d (patch)
treeeab61984739aca8cef8ef88f0742b942b7c868d3 /library/cpp/archive/models_archive_reader.cpp
parentd00b2e410ece1c94481b5fb62df5780c8d870ab4 (diff)
downloadydb-db26b26fad338fdc3b6b326374b9a53b1c75dd7d.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;
+}