Stop timeout in api_mock_gpu_canvas.

Large paths can lead to large processing times for path effects and
hence timeouts.

Also re-enables ShrinkToFit test until that code is finally removed,
but using the PathPriv interface instead.

Bug: oss-fuzz:39040
Change-Id: If3aeac0e8b67cecc6e536cafda01ed6d583655d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494240
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Jim Van Verth 2022-01-12 15:52:49 -05:00 committed by SkCQ
parent 8522bf910a
commit db1d93f3b4
2 changed files with 11 additions and 2 deletions

View File

@ -7,6 +7,7 @@
#include "fuzz/Fuzz.h"
#include "fuzz/FuzzCommon.h"
#include "src/core/SkPathPriv.h"
// We don't always want to test NaNs and infinities.
static void fuzz_nice_float(Fuzz* fuzz, float* f) {
@ -44,9 +45,9 @@ void FuzzNicePath(Fuzz* fuzz, SkPath* path, int maxOps) {
return;
}
// How many items in the switch statement below.
constexpr uint8_t PATH_OPERATIONS = 32;
constexpr uint8_t MAX_PATH_OPERATION = 32;
uint8_t op;
fuzz->nextRange(&op, 0, PATH_OPERATIONS);
fuzz->nextRange(&op, 0, MAX_PATH_OPERATION);
bool test;
SkPath p;
SkMatrix m;
@ -212,6 +213,9 @@ void FuzzNicePath(Fuzz* fuzz, SkPath* path, int maxOps) {
fuzz_nice_float(fuzz, &a, &b);
path->setLastPt(a, b);
break;
case MAX_PATH_OPERATION:
SkPathPriv::ShrinkToFit(path);
break;
default:
SkASSERT(false);

View File

@ -82,6 +82,11 @@ protected:
SkRegion::Iterator iter(rgn);
for (; !iter.done(); iter.next()) {
const SkIRect& rect = iter.rect();
#if defined(SK_BUILD_FOR_FUZZER)
if (rect.height() > 100) {
continue;
}
#endif
for (int y = rect.fTop; y < rect.fBottom; ++y) {
this->nextSpan(rect.fLeft, y, rect.width(), dst);
}