b45d0caa55
This should fix the chrome roll. Change-Id: I2de68f972996bf6124cf5cc27dfd538aa1161057 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316877 Auto-Submit: Kevin Lubick <kjlubick@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Kevin Lubick <kjlubick@google.com>
51 lines
1.2 KiB
C++
51 lines
1.2 KiB
C++
/*
|
|
* Copyright 2018 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "fuzz/Fuzz.h"
|
|
#include "fuzz/FuzzCommon.h"
|
|
#include "include/core/SkData.h"
|
|
#include "include/core/SkPath.h"
|
|
#include "include/core/SkRegion.h"
|
|
|
|
|
|
void FuzzRegionSetPath(Fuzz* fuzz) {
|
|
SkPath p;
|
|
FuzzNicePath(fuzz, &p, 1000);
|
|
SkRegion r1;
|
|
bool initR1;
|
|
fuzz->next(&initR1);
|
|
if (initR1) {
|
|
fuzz->next(&r1);
|
|
}
|
|
SkRegion r2;
|
|
fuzz->next(&r2);
|
|
|
|
r1.setPath(p, r2);
|
|
|
|
// Do some follow on computations to make sure region is well-formed.
|
|
r1.computeRegionComplexity();
|
|
r1.isComplex();
|
|
if (r1 == r2) {
|
|
r1.contains(0,0);
|
|
} else {
|
|
r1.contains(1,1);
|
|
}
|
|
}
|
|
|
|
// TODO(kjlubick): remove IS_FUZZING... after https://crrev.com/c/2410304 lands
|
|
#if defined(SK_BUILD_FOR_LIBFUZZER) || defined(IS_FUZZING_WITH_LIBFUZZER)
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|
if (size > 512) {
|
|
return 0;
|
|
}
|
|
sk_sp<SkData> bytes(SkData::MakeWithoutCopy(data, size));
|
|
Fuzz fuzz(bytes);
|
|
FuzzRegionSetPath(&fuzz);
|
|
return 0;
|
|
}
|
|
#endif
|