2af13c135b
This reverts commit44b7568c8a
. Reason for revert: Google 3 CL has landed Original change's description: > Revert "Fix compilation w/ "skia_enable_svg = false" (take 2)" > > This reverts commit30a6b101f4
. > > Reason for revert: Maybe blocking G3 roll? > > Original change's description: > > Fix compilation w/ "skia_enable_svg = false" (take 2) > > > > Change-Id: I036ae171809af56cc9594704b44705ebd095ec80 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/443898 > > Reviewed-by: Florin Malita <fmalita@chromium.org> > > Commit-Queue: Robert Phillips <robertphillips@google.com> > > TBR=robertphillips@google.com,fmalita@chromium.org,fmalita@google.com,skcq-be@skia-corp.google.com.iam.gserviceaccount.com > > Change-Id: Ibee3819e073b04efdf9736058c1f9b288249620c > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444216 > Reviewed-by: Robert Phillips <robertphillips@google.com> > Commit-Queue: Robert Phillips <robertphillips@google.com> # Not skipping CQ checks because this is a reland. Change-Id: Idf73d864108067ee1c34e88ee4e5236847abd582 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444501 Reviewed-by: Florin Malita <fmalita@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
/*
|
|
* Copyright 2020 Google, LLC
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "include/core/SkData.h"
|
|
#include "include/core/SkStream.h"
|
|
#include "include/core/SkSurface.h"
|
|
#include "modules/svg/include/SkSVGDOM.h"
|
|
#include "modules/svg/include/SkSVGNode.h"
|
|
|
|
#if defined(SK_ENABLE_SVG)
|
|
|
|
void FuzzSVG(sk_sp<SkData> bytes) {
|
|
uint8_t w = 100;
|
|
uint8_t h = 200;
|
|
|
|
SkMemoryStream stream(bytes);
|
|
sk_sp<SkSVGDOM> dom = SkSVGDOM::MakeFromStream(stream);
|
|
if (!dom) {
|
|
return;
|
|
}
|
|
|
|
auto s = SkSurface::MakeRasterN32Premul(128, 128);
|
|
if (!s) {
|
|
return;
|
|
}
|
|
SkSize winSize = SkSize::Make(w, h);
|
|
dom->setContainerSize(winSize);
|
|
dom->containerSize();
|
|
dom->render(s->getCanvas());
|
|
|
|
}
|
|
|
|
#if defined(SK_BUILD_FOR_LIBFUZZER)
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|
if (size > 30000) {
|
|
return 0;
|
|
}
|
|
auto bytes = SkData::MakeWithoutCopy(data, size);
|
|
FuzzSVG(bytes);
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
#endif // SK_ENABLE_SVG
|