diff options
author | swarmer <swarmer@yandex-team.com> | 2024-02-11 22:08:52 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@ydb.tech> | 2024-02-14 14:26:02 +0000 |
commit | 92efa0adbb25f74c0eac17404290b1df61643c2d (patch) | |
tree | aa8117b2e29d61e27eba3b3317e9a4336bf50f91 /library/cpp/archive/models_archive_reader.cpp | |
parent | 79c83250e10e57d403e60ebcd1c2931005ef8914 (diff) | |
download | ydb-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.cpp | 15 |
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; +} |