#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "net/spdy/fuzzing/hpack_fuzz_util.h"
#include <algorithm>
#include <cmath>
#include <memory>
#include "base/containers/span.h"
#include "base/numerics/byte_conversions.h"
#include "base/rand_util.h"
#include "net/third_party/quiche/src/quiche/common/http/http_header_block.h"
#include "net/third_party/quiche/src/quiche/http2/hpack/hpack_constants.h"
namespace spdy {
namespace {
HttpHeaderBlock;
const size_t kHeaderCountMean = …;
const size_t kHeaderCountMax = …;
const size_t kHeaderIndexMean = …;
const size_t kHeaderIndexMax = …;
const size_t kNameLengthMean = …;
const size_t kNameLengthMax = …;
const size_t kValueLengthMean = …;
const size_t kValueLengthMax = …;
}
RandBytesAsString;
map;
HpackFuzzUtil::GeneratorContext::GeneratorContext() = default;
HpackFuzzUtil::GeneratorContext::~GeneratorContext() = default;
HpackFuzzUtil::Input::Input() = default;
HpackFuzzUtil::Input::~Input() = default;
HpackFuzzUtil::FuzzerContext::FuzzerContext() = default;
HpackFuzzUtil::FuzzerContext::~FuzzerContext() = default;
void HpackFuzzUtil::InitializeGeneratorContext(GeneratorContext* context) { … }
HttpHeaderBlock HpackFuzzUtil::NextGeneratedHeaderSet(
GeneratorContext* context) { … }
size_t HpackFuzzUtil::SampleExponential(size_t mean, size_t sanity_bound) { … }
bool HpackFuzzUtil::NextHeaderBlock(Input* input, std::string_view* out) { … }
std::string HpackFuzzUtil::HeaderBlockPrefix(size_t block_size) { … }
void HpackFuzzUtil::InitializeFuzzerContext(FuzzerContext* context) { … }
bool HpackFuzzUtil::RunHeaderBlockThroughFuzzerStages(
FuzzerContext* context,
std::string_view input_block) { … }
void HpackFuzzUtil::FlipBits(uint8_t* buffer,
size_t buffer_length,
size_t flip_per_thousand) { … }
}