From be6e1e3b067ee5f3181cf56cda2ce56234c7962f Mon Sep 17 00:00:00 2001 From: Kevin Lubick Date: Thu, 26 Apr 2018 11:06:02 -0400 Subject: [PATCH] [skia] Fix build and expand api_fuzzer size (#1363) --- projects/skia/api_fuzzers.options | 2 +- projects/skia/build.sh | 3 ++- projects/skia/skia.diff | 31 ++++++++++++++++--------------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/projects/skia/api_fuzzers.options b/projects/skia/api_fuzzers.options index 9b7b54dbd..a48b65724 100644 --- a/projects/skia/api_fuzzers.options +++ b/projects/skia/api_fuzzers.options @@ -1,2 +1,2 @@ [libfuzzer] -max_len = 2000 \ No newline at end of file +max_len = 4000 \ No newline at end of file diff --git a/projects/skia/build.sh b/projects/skia/build.sh index 1ad5c5795..bf497d424 100644 --- a/projects/skia/build.sh +++ b/projects/skia/build.sh @@ -67,6 +67,7 @@ $SRC/depot_tools/ninja -C out/Fuzz region_deserialize region_set_path \ api_path_measure api_null_canvas png_encoder \ jpeg_encoder webp_encoder +# Note: GPU is also with the mem constraints options. $SRC/depot_tools/ninja -C out/GPU api_mock_gpu_canvas cp out/Fuzz/region_deserialize $OUT/region_deserialize @@ -137,7 +138,7 @@ patchelf --remove-needed libGLU.so.1 out/GPU/api_mock_gpu_canvas patchelf --remove-needed libGL.so.1 out/GPU/api_mock_gpu_canvas patchelf --remove-needed libX11.so.6 out/GPU/api_mock_gpu_canvas cp out/GPU/api_mock_gpu_canvas $OUT/api_mock_gpu_canvas -cp ./api_mock_gpu_canvas.options $OUT/mock_gpu_canvas.options +cp ./api_mock_gpu_canvas.options $OUT/api_mock_gpu_canvas.options cp ./canvas_seed_corpus.zip $OUT/api_mock_gpu_canvas_seed_corpus.zip cp out/Fuzz/png_encoder $OUT/png_encoder diff --git a/projects/skia/skia.diff b/projects/skia/skia.diff index 641b1f469..40e0e26a3 100644 --- a/projects/skia/skia.diff +++ b/projects/skia/skia.diff @@ -30,10 +30,10 @@ index b22b8ebebb..aec422fa96 100644 const uint8_t* rowA = nullptr; const uint8_t* rowB = nullptr; diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp -index 5c5247c4cc..a5c9767006 100644 +index 362c8b50fd..5935a7a8ab 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp -@@ -1131,6 +1131,12 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint, +@@ -1128,6 +1128,12 @@ void SkDraw::drawPath(const SkPath& origSrcPath, const SkPaint& origPaint, // transform the path into device space pathPtr->transform(*matrix, devPathPtr); @@ -96,10 +96,10 @@ index 7c90634e12..aad2e978ac 100644 SkMask::kComputeBoundsAndRenderImage_CreateMode, style)) { diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp -index 1e0830e0bc..d5be638d30 100644 +index 141b60b252..9e3b761f0a 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp -@@ -1480,6 +1480,13 @@ bool SkPaint::getFillPath(const SkPath& src, SkPath* dst, const SkRect* cullRect +@@ -1479,6 +1479,13 @@ bool SkPaint::getFillPath(const SkPath& src, SkPath* dst, const SkRect* cullRect SkStrokeRec rec(*this, resScale); @@ -114,7 +114,7 @@ index 1e0830e0bc..d5be638d30 100644 SkPath tmpPath; diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp -index 2fd5201066..4cba6a1224 100644 +index 3e4f990930..681ee8c85a 100644 --- a/src/core/SkPath.cpp +++ b/src/core/SkPath.cpp @@ -3347,7 +3347,11 @@ void SkPathPriv::CreateDrawArcPath(SkPath* path, const SkRect& oval, SkScalar st @@ -251,10 +251,10 @@ index 2373e62d46..410fa8a276 100644 int L = SkFixedRoundToInt(left); int R = SkFixedRoundToInt(rite); diff --git a/src/core/SkTextBlob.cpp b/src/core/SkTextBlob.cpp -index eac2430f5f..0d303fdb07 100644 +index 2c29d9d613..0559d7358e 100644 --- a/src/core/SkTextBlob.cpp +++ b/src/core/SkTextBlob.cpp -@@ -801,7 +801,11 @@ sk_sp SkTextBlob::MakeFromBuffer(SkReadBuffer& reader) { +@@ -800,7 +800,11 @@ sk_sp SkTextBlob::MakeFromBuffer(SkReadBuffer& reader) { // End-of-runs marker. break; } @@ -267,7 +267,7 @@ index eac2430f5f..0d303fdb07 100644 PositioningAndExtended pe; pe.intValue = reader.read32(); GlyphPositioning pos = pe.positioning; -@@ -812,7 +816,11 @@ sk_sp SkTextBlob::MakeFromBuffer(SkReadBuffer& reader) { +@@ -811,7 +815,11 @@ sk_sp SkTextBlob::MakeFromBuffer(SkReadBuffer& reader) { if (textSize < 0 || static_cast(textSize) > reader.size()) { return nullptr; } @@ -313,14 +313,15 @@ index a541b91476..53cd354b79 100644 const SkMatrix& mat = this->getMatrix(); SkPoint src, dst; diff --git a/src/effects/SkDashPathEffect.cpp b/src/effects/SkDashPathEffect.cpp -index cced73f72e..bd5fc114f7 100644 +index 4cb98b3ad8..2710c122d8 100644 --- a/src/effects/SkDashPathEffect.cpp +++ b/src/effects/SkDashPathEffect.cpp -@@ -367,6 +367,11 @@ void SkDashImpl::flatten(SkWriteBuffer& buffer) const { - sk_sp SkDashImpl::CreateProc(SkReadBuffer& buffer) { - const SkScalar phase = buffer.readScalar(); - uint32_t count = buffer.getArrayCount(); +@@ -373,6 +373,12 @@ sk_sp SkDashImpl::CreateProc(SkReadBuffer& buffer) { + return nullptr; + } + +#if defined(IS_FUZZING) ++ // TODO(kjlubick) Can this be removed now that we have the check above? + if (count > 20) { + return nullptr; + } @@ -395,7 +396,7 @@ index ec4e3fec77..bd720fd491 100644 } #endif//!defined(SK_BUILD_FOR_WIN) && !defined(SK_BUILD_FOR_ANDROID) diff --git a/src/utils/SkOffsetPolygon.cpp b/src/utils/SkOffsetPolygon.cpp -index 94fe96562d..da6afedd84 100755 +index 47b41250e2..ce69469e80 100755 --- a/src/utils/SkOffsetPolygon.cpp +++ b/src/utils/SkOffsetPolygon.cpp @@ -260,6 +260,11 @@ bool SkInsetConvexPolygon(const SkPoint* inputPolygonVerts, int inputPolygonSize @@ -411,7 +412,7 @@ index 94fe96562d..da6afedd84 100755 int winding = get_winding(inputPolygonVerts, inputPolygonSize); if (0 == winding) { diff --git a/src/utils/SkShadowTessellator.cpp b/src/utils/SkShadowTessellator.cpp -index 5d6a4cc15d..a6bbc30d7c 100755 +index 0bf1adaaa4..347bc951a3 100755 --- a/src/utils/SkShadowTessellator.cpp +++ b/src/utils/SkShadowTessellator.cpp @@ -254,6 +254,11 @@ bool SkBaseShadowTessellator::addArc(const SkVector& nextNormal, bool finishArc)