##// 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:

r38191:fa0ddd5e default
r41525:189e06b2 stable
Show More
bdiff.cc
44 lines | 1.0 KiB | text/x-c | CppLexer
/*
* bdiff.cc - fuzzer harness for bdiff.c
*
* Copyright 2018, Google Inc.
*
* This software may be used and distributed according to the terms of
* the GNU General Public License, incorporated herein by reference.
*/
#include <memory>
#include <stdlib.h>
#include "fuzzutil.h"
extern "C" {
#include "bdiff.h"
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
{
auto maybe_inputs = SplitInputs(Data, Size);
if (!maybe_inputs) {
return 0;
}
auto inputs = std::move(maybe_inputs.value());
struct bdiff_line *a, *b;
int an = bdiff_splitlines(inputs.left.get(), inputs.left_size, &a);
int bn = bdiff_splitlines(inputs.right.get(), inputs.right_size, &b);
struct bdiff_hunk l;
bdiff_diff(a, an, b, bn, &l);
free(a);
free(b);
bdiff_freehunks(l.next);
return 0; // Non-zero return values are reserved for future use.
}
#ifdef HG_FUZZER_INCLUDE_MAIN
int main(int argc, char **argv)
{
const char data[] = "asdf";
return LLVMFuzzerTestOneInput((const uint8_t *)data, 4);
}
#endif
} // extern "C"