##// END OF EJS Templates
revlog: make sure we never use sparserevlog without general delta (issue6056)...
revlog: make sure we never use sparserevlog without general delta (issue6056) We are getting user report where the delta code tries to use `sparse-revlog` logic on repository where `generaldelta` is disabled. This can't work so we ensure the two booleans have a consistent value. Creating this kind of repository is not expected to be possible the current bug report point at a clonebundle related bug that is still to be properly isolated (Yuya Nishihara seems to a have done it). Corrupting a repository to reproduce the issue is possible. A test using this method is included in this fix.

File last commit:

r38192:36d55f90 default
r41525:189e06b2 stable
Show More
fuzzutil.h
47 lines | 1.2 KiB | text/x-c | CLexer
#ifndef CONTRIB_FUZZ_FUZZUTIL_H
#define CONTRIB_FUZZ_FUZZUTIL_H
#include <iostream>
#include <memory>
#include <stdint.h>
/* Try and use std::optional, but failing that assume we'll have a
* workable https://abseil.io/ install on the include path to get
* their backport of std::optional. */
#ifdef __has_include
#if __has_include(<optional>) && __cplusplus >= 201703L
#include <optional>
#define CONTRIB_FUZZ_HAVE_STD_OPTIONAL
#endif
#endif
#ifdef CONTRIB_FUZZ_HAVE_STD_OPTIONAL
namespace contrib
{
using std::nullopt;
using std::optional;
} /* namespace contrib */
#else
#include "third_party/absl/types/optional.h"
namespace contrib
{
using absl::nullopt;
using absl::optional;
} /* namespace contrib */
#endif
/* set DEBUG to 1 for a few debugging prints, or 2 for a lot */
#define DEBUG 0
#define LOG(level) \
if (level <= DEBUG) \
std::cout
struct two_inputs {
std::unique_ptr<char[]> right;
size_t right_size;
std::unique_ptr<char[]> left;
size_t left_size;
};
/* Split a non-zero-length input into two inputs. */
contrib::optional<two_inputs> SplitInputs(const uint8_t *Data, size_t Size);
#endif /* CONTRIB_FUZZ_FUZZUTIL_H */