diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /util/generic/fuzz/vector | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
download | ydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/fuzz/vector')
-rw-r--r-- | util/generic/fuzz/vector/main.cpp | 90 | ||||
-rw-r--r-- | util/generic/fuzz/vector/ya.make | 14 |
2 files changed, 52 insertions, 52 deletions
diff --git a/util/generic/fuzz/vector/main.cpp b/util/generic/fuzz/vector/main.cpp index 9d3211da96..0a0293f795 100644 --- a/util/generic/fuzz/vector/main.cpp +++ b/util/generic/fuzz/vector/main.cpp @@ -1,47 +1,47 @@ -#include <util/generic/vector.h> -#include <util/stream/mem.h> - -template <class T> +#include <util/generic/vector.h> +#include <util/stream/mem.h> + +template <class T> static inline T Read(IInputStream& in) { - T t; - - in.LoadOrFail(&t, sizeof(t)); - - return t; -} - -extern "C" int LLVMFuzzerTestOneInput(const ui8* data, size_t size) { - TMemoryInput mi(data, size); - - try { + T t; + + in.LoadOrFail(&t, sizeof(t)); + + return t; +} + +extern "C" int LLVMFuzzerTestOneInput(const ui8* data, size_t size) { + TMemoryInput mi(data, size); + + try { TVector<ui16> v; - - while (mi.Avail()) { - char cmd = Read<char>(mi); - - switch (cmd % 2) { - case 0: { - const size_t cnt = 1 + Read<ui8>(mi) % 16; - - for (size_t i = 0; i < cnt; ++i) { - v.push_back(i); - } - - break; - } - - case 1: { - if (v) { - v.pop_back(); - } - - break; - } - } - } - } catch (...) { - // ¯\_(ツ)_/¯ - } - - return 0; // Non-zero return values are reserved for future use. -} + + while (mi.Avail()) { + char cmd = Read<char>(mi); + + switch (cmd % 2) { + case 0: { + const size_t cnt = 1 + Read<ui8>(mi) % 16; + + for (size_t i = 0; i < cnt; ++i) { + v.push_back(i); + } + + break; + } + + case 1: { + if (v) { + v.pop_back(); + } + + break; + } + } + } + } catch (...) { + // ¯\_(ツ)_/¯ + } + + return 0; // Non-zero return values are reserved for future use. +} diff --git a/util/generic/fuzz/vector/ya.make b/util/generic/fuzz/vector/ya.make index 14986170eb..b8614f6411 100644 --- a/util/generic/fuzz/vector/ya.make +++ b/util/generic/fuzz/vector/ya.make @@ -1,13 +1,13 @@ FUZZ() - + OWNER( pg g:util ) SUBSCRIBER(g:util-subscribers) - -SRCS( - main.cpp -) - -END() + +SRCS( + main.cpp +) + +END() |