aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/blockcodecs
diff options
context:
space:
mode:
authoryazevnul <yazevnul@yandex-team.ru>2022-02-10 16:46:48 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:48 +0300
commit9abfb1a53b7f7b791444d1378e645d8fad9b06ed (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/blockcodecs
parent8cbc307de0221f84c80c42dcbe07d40727537e2c (diff)
downloadydb-9abfb1a53b7f7b791444d1378e645d8fad9b06ed.tar.gz
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/blockcodecs')
-rw-r--r--library/cpp/blockcodecs/codecs_ut.cpp80
-rw-r--r--library/cpp/blockcodecs/core/codecs.cpp4
-rw-r--r--library/cpp/blockcodecs/core/stream.cpp6
-rw-r--r--library/cpp/blockcodecs/core/stream.h12
-rw-r--r--library/cpp/blockcodecs/fuzz/main.cpp146
-rw-r--r--library/cpp/blockcodecs/fuzz/proto/case.proto20
-rw-r--r--library/cpp/blockcodecs/fuzz/proto/ya.make24
-rw-r--r--library/cpp/blockcodecs/fuzz/ya.make28
8 files changed, 160 insertions, 160 deletions
diff --git a/library/cpp/blockcodecs/codecs_ut.cpp b/library/cpp/blockcodecs/codecs_ut.cpp
index d94a151075..bfe5a23690 100644
--- a/library/cpp/blockcodecs/codecs_ut.cpp
+++ b/library/cpp/blockcodecs/codecs_ut.cpp
@@ -7,7 +7,7 @@
#include <util/string/join.h>
#include <util/digest/multi.h>
-Y_UNIT_TEST_SUITE(TBlockCodecsTest) {
+Y_UNIT_TEST_SUITE(TBlockCodecsTest) {
using namespace NBlockCodecs;
TBuffer Buffer(TStringBuf b) {
@@ -67,79 +67,79 @@ Y_UNIT_TEST_SUITE(TBlockCodecsTest) {
}
}
- Y_UNIT_TEST(TestAllAtOnce0) {
+ Y_UNIT_TEST(TestAllAtOnce0) {
TestAllAtOnce(20, 0);
}
- Y_UNIT_TEST(TestAllAtOnce1) {
+ Y_UNIT_TEST(TestAllAtOnce1) {
TestAllAtOnce(20, 1);
}
- Y_UNIT_TEST(TestAllAtOnce2) {
+ Y_UNIT_TEST(TestAllAtOnce2) {
TestAllAtOnce(20, 2);
}
- Y_UNIT_TEST(TestAllAtOnce3) {
+ Y_UNIT_TEST(TestAllAtOnce3) {
TestAllAtOnce(20, 3);
}
- Y_UNIT_TEST(TestAllAtOnce4) {
+ Y_UNIT_TEST(TestAllAtOnce4) {
TestAllAtOnce(20, 4);
}
- Y_UNIT_TEST(TestAllAtOnce5) {
+ Y_UNIT_TEST(TestAllAtOnce5) {
TestAllAtOnce(20, 5);
}
- Y_UNIT_TEST(TestAllAtOnce6) {
+ Y_UNIT_TEST(TestAllAtOnce6) {
TestAllAtOnce(20, 6);
}
- Y_UNIT_TEST(TestAllAtOnce7) {
+ Y_UNIT_TEST(TestAllAtOnce7) {
TestAllAtOnce(20, 7);
}
- Y_UNIT_TEST(TestAllAtOnce8) {
+ Y_UNIT_TEST(TestAllAtOnce8) {
TestAllAtOnce(20, 8);
}
- Y_UNIT_TEST(TestAllAtOnce9) {
+ Y_UNIT_TEST(TestAllAtOnce9) {
TestAllAtOnce(20, 9);
}
- Y_UNIT_TEST(TestAllAtOnce10) {
+ Y_UNIT_TEST(TestAllAtOnce10) {
TestAllAtOnce(20, 10);
}
- Y_UNIT_TEST(TestAllAtOnce12) {
+ Y_UNIT_TEST(TestAllAtOnce12) {
TestAllAtOnce(20, 12);
}
- Y_UNIT_TEST(TestAllAtOnce13) {
+ Y_UNIT_TEST(TestAllAtOnce13) {
TestAllAtOnce(20, 13);
}
- Y_UNIT_TEST(TestAllAtOnce14) {
+ Y_UNIT_TEST(TestAllAtOnce14) {
TestAllAtOnce(20, 14);
}
- Y_UNIT_TEST(TestAllAtOnce15) {
+ Y_UNIT_TEST(TestAllAtOnce15) {
TestAllAtOnce(20, 15);
}
- Y_UNIT_TEST(TestAllAtOnce16) {
+ Y_UNIT_TEST(TestAllAtOnce16) {
TestAllAtOnce(20, 16);
}
- Y_UNIT_TEST(TestAllAtOnce17) {
+ Y_UNIT_TEST(TestAllAtOnce17) {
TestAllAtOnce(20, 17);
}
- Y_UNIT_TEST(TestAllAtOnce18) {
+ Y_UNIT_TEST(TestAllAtOnce18) {
TestAllAtOnce(20, 18);
}
- Y_UNIT_TEST(TestAllAtOnce19) {
+ Y_UNIT_TEST(TestAllAtOnce19) {
TestAllAtOnce(20, 19);
}
@@ -190,83 +190,83 @@ Y_UNIT_TEST_SUITE(TBlockCodecsTest) {
}
}
- Y_UNIT_TEST(TestStreams0) {
+ Y_UNIT_TEST(TestStreams0) {
TestStreams(20, 0);
}
- Y_UNIT_TEST(TestStreams1) {
+ Y_UNIT_TEST(TestStreams1) {
TestStreams(20, 1);
}
- Y_UNIT_TEST(TestStreams2) {
+ Y_UNIT_TEST(TestStreams2) {
TestStreams(20, 2);
}
- Y_UNIT_TEST(TestStreams3) {
+ Y_UNIT_TEST(TestStreams3) {
TestStreams(20, 3);
}
- Y_UNIT_TEST(TestStreams4) {
+ Y_UNIT_TEST(TestStreams4) {
TestStreams(20, 4);
}
- Y_UNIT_TEST(TestStreams5) {
+ Y_UNIT_TEST(TestStreams5) {
TestStreams(20, 5);
}
- Y_UNIT_TEST(TestStreams6) {
+ Y_UNIT_TEST(TestStreams6) {
TestStreams(20, 6);
}
- Y_UNIT_TEST(TestStreams7) {
+ Y_UNIT_TEST(TestStreams7) {
TestStreams(20, 7);
}
- Y_UNIT_TEST(TestStreams8) {
+ Y_UNIT_TEST(TestStreams8) {
TestStreams(20, 8);
}
- Y_UNIT_TEST(TestStreams9) {
+ Y_UNIT_TEST(TestStreams9) {
TestStreams(20, 9);
}
- Y_UNIT_TEST(TestStreams10) {
+ Y_UNIT_TEST(TestStreams10) {
TestStreams(20, 10);
}
- Y_UNIT_TEST(TestStreams11) {
+ Y_UNIT_TEST(TestStreams11) {
TestStreams(20, 11);
}
- Y_UNIT_TEST(TestStreams12) {
+ Y_UNIT_TEST(TestStreams12) {
TestStreams(20, 12);
}
- Y_UNIT_TEST(TestStreams13) {
+ Y_UNIT_TEST(TestStreams13) {
TestStreams(20, 13);
}
- Y_UNIT_TEST(TestStreams14) {
+ Y_UNIT_TEST(TestStreams14) {
TestStreams(20, 14);
}
- Y_UNIT_TEST(TestStreams15) {
+ Y_UNIT_TEST(TestStreams15) {
TestStreams(20, 15);
}
- Y_UNIT_TEST(TestStreams16) {
+ Y_UNIT_TEST(TestStreams16) {
TestStreams(20, 16);
}
- Y_UNIT_TEST(TestStreams17) {
+ Y_UNIT_TEST(TestStreams17) {
TestStreams(20, 17);
}
- Y_UNIT_TEST(TestStreams18) {
+ Y_UNIT_TEST(TestStreams18) {
TestStreams(20, 18);
}
- Y_UNIT_TEST(TestStreams19) {
+ Y_UNIT_TEST(TestStreams19) {
TestStreams(20, 19);
}
diff --git a/library/cpp/blockcodecs/core/codecs.cpp b/library/cpp/blockcodecs/core/codecs.cpp
index 94e2d324ed..21506e812b 100644
--- a/library/cpp/blockcodecs/core/codecs.cpp
+++ b/library/cpp/blockcodecs/core/codecs.cpp
@@ -38,8 +38,8 @@ namespace {
}
inline void ListCodecs(TCodecList& lst) const {
- for (const auto& it : Registry) {
- lst.push_back(it.first);
+ for (const auto& it : Registry) {
+ lst.push_back(it.first);
}
Sort(lst.begin(), lst.end());
diff --git a/library/cpp/blockcodecs/core/stream.cpp b/library/cpp/blockcodecs/core/stream.cpp
index fe0347a261..4f7db3c32b 100644
--- a/library/cpp/blockcodecs/core/stream.cpp
+++ b/library/cpp/blockcodecs/core/stream.cpp
@@ -64,7 +64,7 @@ namespace {
}
}
-TCodedOutput::TCodedOutput(IOutputStream* out, const ICodec* c, size_t bufLen)
+TCodedOutput::TCodedOutput(IOutputStream* out, const ICodec* c, size_t bufLen)
: C_(c)
, D_(bufLen)
, S_(out)
@@ -95,7 +95,7 @@ void TCodedOutput::DoWrite(const void* buf, size_t len) {
D_.Append(in, avail);
- Y_ASSERT(!D_.Avail());
+ Y_ASSERT(!D_.Avail());
in += avail;
len -= avail;
@@ -146,7 +146,7 @@ void TCodedOutput::DoFinish() {
}
}
-TDecodedInput::TDecodedInput(IInputStream* in)
+TDecodedInput::TDecodedInput(IInputStream* in)
: S_(in)
, C_(nullptr)
{
diff --git a/library/cpp/blockcodecs/core/stream.h b/library/cpp/blockcodecs/core/stream.h
index a66c2e0c31..fd44ef88f2 100644
--- a/library/cpp/blockcodecs/core/stream.h
+++ b/library/cpp/blockcodecs/core/stream.h
@@ -9,9 +9,9 @@
namespace NBlockCodecs {
struct ICodec;
- class TCodedOutput: public IOutputStream {
+ class TCodedOutput: public IOutputStream {
public:
- TCodedOutput(IOutputStream* out, const ICodec* c, size_t bufLen);
+ TCodedOutput(IOutputStream* out, const ICodec* c, size_t bufLen);
~TCodedOutput() override;
private:
@@ -25,12 +25,12 @@ namespace NBlockCodecs {
const ICodec* C_;
TBuffer D_;
TBuffer O_;
- IOutputStream* S_;
+ IOutputStream* S_;
};
- class TDecodedInput: public IWalkInput {
+ class TDecodedInput: public IWalkInput {
public:
- TDecodedInput(IInputStream* in);
+ TDecodedInput(IInputStream* in);
TDecodedInput(IInputStream* in, const ICodec* codec);
~TDecodedInput() override;
@@ -40,7 +40,7 @@ namespace NBlockCodecs {
private:
TBuffer D_;
- IInputStream* S_;
+ IInputStream* S_;
const ICodec* C_;
};
}
diff --git a/library/cpp/blockcodecs/fuzz/main.cpp b/library/cpp/blockcodecs/fuzz/main.cpp
index cddf79f7f6..763c6c5a10 100644
--- a/library/cpp/blockcodecs/fuzz/main.cpp
+++ b/library/cpp/blockcodecs/fuzz/main.cpp
@@ -1,84 +1,84 @@
-#include <contrib/libs/protobuf-mutator/src/libfuzzer/libfuzzer_macro.h>
+#include <contrib/libs/protobuf-mutator/src/libfuzzer/libfuzzer_macro.h>
#include <google/protobuf/stubs/logging.h>
-
+
#include <library/cpp/blockcodecs/codecs.h>
#include <library/cpp/blockcodecs/fuzz/proto/case.pb.h>
#include <library/cpp/blockcodecs/stream.h>
-#include <util/stream/input.h>
-#include <util/stream/length.h>
+#include <util/stream/input.h>
+#include <util/stream/length.h>
#include <util/stream/mem.h>
-#include <util/stream/null.h>
-#include <util/stream/str.h>
+#include <util/stream/null.h>
+#include <util/stream/str.h>
+
+using NBlockCodecs::NFuzz::TPackUnpackCase;
+using NBlockCodecs::TCodedOutput;
+using NBlockCodecs::TDecodedInput;
-using NBlockCodecs::NFuzz::TPackUnpackCase;
-using NBlockCodecs::TCodedOutput;
-using NBlockCodecs::TDecodedInput;
+static void ValidateBufferSize(const ui32 size) {
+ Y_ENSURE(size > 0 && size <= 16ULL * 1024);
+}
-static void ValidateBufferSize(const ui32 size) {
- Y_ENSURE(size > 0 && size <= 16ULL * 1024);
-}
-
-static void DoOnlyDecode(const TPackUnpackCase& case_) {
- if (!case_.GetPacked()) {
- return;
+static void DoOnlyDecode(const TPackUnpackCase& case_) {
+ if (!case_.GetPacked()) {
+ return;
}
- TMemoryInput mi(case_.GetData().data(), case_.GetData().size());
- TDecodedInput di(&mi);
- TNullOutput no;
- TCountingOutput cno(&no);
- TransferData(&di, &cno);
+ TMemoryInput mi(case_.GetData().data(), case_.GetData().size());
+ TDecodedInput di(&mi);
+ TNullOutput no;
+ TCountingOutput cno(&no);
+ TransferData(&di, &cno);
+}
+
+static void DoDecodeEncode(const TPackUnpackCase& case_) {
+ auto* const codec = NBlockCodecs::Codec(case_.GetCodecName());
+ Y_ENSURE(codec);
+
+ TMemoryInput mi(case_.GetData().data(), case_.GetData().size());
+ TDecodedInput di(&mi, codec);
+ TStringStream decoded;
+ TransferData(&di, &decoded);
+ TNullOutput no;
+ TCountingOutput cno(&no);
+ TCodedOutput co(&cno, codec, case_.GetBufferLength());
+ TransferData(&decoded, &co);
+ co.Flush();
+
+ Y_VERIFY((case_.GetData().size() > 0) == (cno.Counter() > 0));
+ Y_VERIFY((case_.GetData().size() > 0) == (decoded.Str().size() > 0));
+}
+
+static void DoEncodeDecode(const TPackUnpackCase& case_) {
+ auto* const codec = NBlockCodecs::Codec(case_.GetCodecName());
+ Y_ENSURE(codec);
+
+ TMemoryInput mi(case_.GetData().data(), case_.GetData().size());
+ TStringStream encoded;
+ TCodedOutput co(&encoded, codec, case_.GetBufferLength());
+ TransferData(&mi, &co);
+ co.Flush();
+ TStringStream decoded;
+ TDecodedInput di(&encoded, codec);
+ TransferData(&di, &decoded);
+
+ Y_VERIFY((case_.GetData().size() > 0) == (encoded.Str().size() > 0));
+ Y_VERIFY(case_.GetData() == decoded.Str());
+}
+
+DEFINE_BINARY_PROTO_FUZZER(const TPackUnpackCase& case_) {
+ try {
+ if (!case_.GetCodecName()) {
+ DoOnlyDecode(case_);
+ return;
+ }
+
+ ValidateBufferSize(case_.GetBufferLength());
+ if (case_.GetPacked()) {
+ DoDecodeEncode(case_);
+ } else {
+ DoEncodeDecode(case_);
+ }
+ } catch (const std::exception&) {
+ }
}
-
-static void DoDecodeEncode(const TPackUnpackCase& case_) {
- auto* const codec = NBlockCodecs::Codec(case_.GetCodecName());
- Y_ENSURE(codec);
-
- TMemoryInput mi(case_.GetData().data(), case_.GetData().size());
- TDecodedInput di(&mi, codec);
- TStringStream decoded;
- TransferData(&di, &decoded);
- TNullOutput no;
- TCountingOutput cno(&no);
- TCodedOutput co(&cno, codec, case_.GetBufferLength());
- TransferData(&decoded, &co);
- co.Flush();
-
- Y_VERIFY((case_.GetData().size() > 0) == (cno.Counter() > 0));
- Y_VERIFY((case_.GetData().size() > 0) == (decoded.Str().size() > 0));
-}
-
-static void DoEncodeDecode(const TPackUnpackCase& case_) {
- auto* const codec = NBlockCodecs::Codec(case_.GetCodecName());
- Y_ENSURE(codec);
-
- TMemoryInput mi(case_.GetData().data(), case_.GetData().size());
- TStringStream encoded;
- TCodedOutput co(&encoded, codec, case_.GetBufferLength());
- TransferData(&mi, &co);
- co.Flush();
- TStringStream decoded;
- TDecodedInput di(&encoded, codec);
- TransferData(&di, &decoded);
-
- Y_VERIFY((case_.GetData().size() > 0) == (encoded.Str().size() > 0));
- Y_VERIFY(case_.GetData() == decoded.Str());
-}
-
-DEFINE_BINARY_PROTO_FUZZER(const TPackUnpackCase& case_) {
- try {
- if (!case_.GetCodecName()) {
- DoOnlyDecode(case_);
- return;
- }
-
- ValidateBufferSize(case_.GetBufferLength());
- if (case_.GetPacked()) {
- DoDecodeEncode(case_);
- } else {
- DoEncodeDecode(case_);
- }
- } catch (const std::exception&) {
- }
-}
diff --git a/library/cpp/blockcodecs/fuzz/proto/case.proto b/library/cpp/blockcodecs/fuzz/proto/case.proto
index 622ed0ce47..85518b0da9 100644
--- a/library/cpp/blockcodecs/fuzz/proto/case.proto
+++ b/library/cpp/blockcodecs/fuzz/proto/case.proto
@@ -1,10 +1,10 @@
-syntax="proto3";
-
-package NBlockCodecs.NFuzz;
-
-message TPackUnpackCase {
- bool Packed = 1;
- uint32 BufferLength = 2;
- string CodecName = 3;
- bytes Data = 4;
-}
+syntax="proto3";
+
+package NBlockCodecs.NFuzz;
+
+message TPackUnpackCase {
+ bool Packed = 1;
+ uint32 BufferLength = 2;
+ string CodecName = 3;
+ bytes Data = 4;
+}
diff --git a/library/cpp/blockcodecs/fuzz/proto/ya.make b/library/cpp/blockcodecs/fuzz/proto/ya.make
index dbd32e0f1c..da840bc8c9 100644
--- a/library/cpp/blockcodecs/fuzz/proto/ya.make
+++ b/library/cpp/blockcodecs/fuzz/proto/ya.make
@@ -1,14 +1,14 @@
-OWNER(
- yazevnul
- g:util
-)
-
-PROTO_LIBRARY()
-
-SRCS(
- case.proto
-)
-
+OWNER(
+ yazevnul
+ g:util
+)
+
+PROTO_LIBRARY()
+
+SRCS(
+ case.proto
+)
+
EXCLUDE_TAGS(GO_PROTO)
-END()
+END()
diff --git a/library/cpp/blockcodecs/fuzz/ya.make b/library/cpp/blockcodecs/fuzz/ya.make
index dee86d56a2..bc8becc9e1 100644
--- a/library/cpp/blockcodecs/fuzz/ya.make
+++ b/library/cpp/blockcodecs/fuzz/ya.make
@@ -3,21 +3,21 @@ OWNER(
g:util
)
-IF (NOT MSVC)
- FUZZ()
+IF (NOT MSVC)
+ FUZZ()
- SIZE(MEDIUM)
+ SIZE(MEDIUM)
- SRCS(
- main.cpp
- )
-
- PEERDIR(
- contrib/libs/protobuf
- contrib/libs/protobuf-mutator
+ SRCS(
+ main.cpp
+ )
+
+ PEERDIR(
+ contrib/libs/protobuf
+ contrib/libs/protobuf-mutator
library/cpp/blockcodecs
library/cpp/blockcodecs/fuzz/proto
- )
-
- END()
-ENDIF()
+ )
+
+ END()
+ENDIF()