##// END OF EJS Templates
packaging: use "--python python" for centos7 to avoid explicit "python2"...
packaging: use "--python python" for centos7 to avoid explicit "python2" This is a partial backout of 92a51a45d44c. We will need to be able to control whether package dependencies are python2 or python3. Generally (at least in recent Fedora), the package prefix match the name of the python executable ... but CentOS 7 doesn't use the python2 prefix in package name or alias for python-docutils yet, so just keep centos7 in the unversioned "python" world. Change the new (unused) buildrpm "--python3" option (introduced in a6dcac6454c1) to "--python python3" to get a more generic method for explicit control over whether we use python, python2 or python3.

File last commit:

r38234:a1c0873a default
r43674:90dc0d31 stable
Show More
fuzzutil.cc
27 lines | 922 B | text/x-c | CppLexer
#include "fuzzutil.h"
#include <cstring>
#include <utility>
contrib::optional<two_inputs> SplitInputs(const uint8_t *Data, size_t Size)
{
if (!Size) {
return contrib::nullopt;
}
// figure out a random point in [0, Size] to split our input.
size_t left_size = (Data[0] / 255.0) * (Size - 1);
// Copy inputs to new allocations so if bdiff over-reads
// AddressSanitizer can detect it.
std::unique_ptr<char[]> left(new char[left_size]);
std::memcpy(left.get(), Data + 1, left_size);
// right starts at the next byte after left ends
size_t right_size = Size - (left_size + 1);
std::unique_ptr<char[]> right(new char[right_size]);
std::memcpy(right.get(), Data + 1 + left_size, right_size);
LOG(2) << "inputs are " << left_size << " and " << right_size
<< " bytes" << std::endl;
two_inputs result = {std::move(right), right_size, std::move(left),
left_size};
return result;
}