Flutter Engine
The Flutter Engine
FuzzColorspace.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2023 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "fuzz/Fuzz.h"
10#include "include/core/SkData.h"
11#include "modules/skcms/skcms.h"
12
13void FuzzColorspace(const uint8_t *data, size_t size) {
15 if (!space) {
16 return;
17 }
18 // Call some arbitrary methods on the colorspace, using a throw-away
19 // variable to prevent the compiler from optimizing things away.
20 int i = 0;
21 if (space->gammaCloseToSRGB()) {
22 i += 1;
23 }
24 if (space->gammaIsLinear()) {
25 i += 1;
26 }
27 if (space->isSRGB()) {
28 i += 1;
29 }
31 space->toProfile(&profile);
33 sk_sp<SkData> data1 = space->serialize();
34 if (SkColorSpace::Equals(space.get(), space2.get()) && i > 5) {
35 SkDebugf("Should never happen %d", (int)data1->size());
36 space2->writeToMemory(nullptr);
37 }
38}
39
40#if defined(SK_BUILD_FOR_LIBFUZZER)
41extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
42 if (size > 4000) {
43 return 0;
44 }
46 return 0;
47}
48#endif
void FuzzColorspace(const uint8_t *data, size_t size)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
bool gammaIsLinear() const
bool gammaCloseToSRGB() const
void toProfile(skcms_ICCProfile *) const
sk_sp< SkColorSpace > makeSRGBGamma() const
static bool Equals(const SkColorSpace *, const SkColorSpace *)
sk_sp< SkColorSpace > makeLinearGamma() const
sk_sp< SkColorSpace > makeColorSpin() const
static sk_sp< SkColorSpace > Deserialize(const void *data, size_t length)
size_t writeToMemory(void *memory) const
sk_sp< SkData > serialize() const
bool isSRGB() const
size_t size() const
Definition: SkData.h:30
T * get() const
Definition: SkRefCnt.h:303
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63