This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "examples/libfuzzer/libfuzzer_example.pb.h" | |
#include "port/protobuf.h" | |
#include "src/libfuzzer/libfuzzer_macro.h" | |
protobuf_mutator::protobuf::LogSilencer log_silincer; | |
// ... | |
// This is the fuzz target | |
DEFINE_BINARY_PROTO_FUZZER(const libfuzzer_example::Msg& message) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax = "proto2"; | |
package libfuzzer_example; | |
import "google/protobuf/any.proto"; | |
message Msg { | |
optional float optional_float = 1; | |
optional uint64 optional_uint64 = 2; | |
optional string optional_string = 3; | |
optional google.protobuf.Any any = 4; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fuzz_target_http.cc | |
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { | |
// Send HTTP request to the container | |
SendFuzzedPayload(Data, Size); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fuzz_target.cc | |
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { | |
SystemUnderTest(Data, Size); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package v3rpc | |
import ( | |
"context" | |
"testing" | |
pb "go.etcd.io/etcd/api/v3/etcdserverpb" | |
txn "go.etcd.io/etcd/server/v3/etcdserver/txn" | |
"go.etcd.io/etcd/server/v3/lease" | |
betesting "go.etcd.io/etcd/server/v3/storage/backend/testing" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Strategy defines a strategy related to a QuorumSystem. | |
type Strategy struct { | |
Qs QuorumSystem | |
SigmaR Sigma | |
SigmaW Sigma | |
nodeToReadProbability map[Node]Probability | |
nodeToWriteProbability map[Node]Probability | |
} | |
// Sigma defines the probabilities of a specific Strategy. Each Expr (quorum) has a probability of being choose associated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Search given some nodes, and a SearchOptions instance, returns the optimal strategy and quorum system in respect of the optimization target and constraints. | |
func Search(nodes []Expr, option SearchOptions) (SearchResult, error) { | |
return performQuorumSearch(nodes, initializeSearchOptions(option)) | |
} | |
func performQuorumSearch(nodes []Expr, opts ...func(options *SearchOptions) error) (SearchResult, error) { | |
sb := &SearchOptions{} | |
// ... (write initializations with default values)... | |
for _, op := range opts { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Strategy defines a strategy related to a QuorumSystem. | |
type Strategy struct { | |
Qs QuorumSystem | |
SigmaR Sigma | |
SigmaW Sigma | |
nodeToReadProbability map[Node]Probability | |
nodeToWriteProbability map[Node]Probability | |
} | |
// Sigma defines the probabilities of a specific Strategy. Each Expr (quorum) has a probability of being choose associated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (qs QuorumSystem) loadOptimalStrategy( | |
optimize OptimizeType, | |
readQuorums []ExprSet, | |
writeQuorums []ExprSet, | |
readFraction DistributionValues, | |
loadLimit *float64, | |
networkLimit *float64, | |
latencyLimit *float64) (*Strategy, error) { | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (qs QuorumSystem) loadOptimalStrategy( | |
optimize OptimizeType, | |
readQuorums []ExprSet, | |
writeQuorums []ExprSet, | |
readFraction DistributionValues, | |
loadLimit *float64, | |
networkLimit *float64, | |
latencyLimit *float64) (*Strategy, error) { | |
... |