Flutter Engine
The Flutter Engine
Fuzz.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2016 Google Inc.
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
9#include "fuzz/Fuzz.h"
10#include "fuzz/FuzzCommon.h"
11
12// UBSAN reminds us that bool can only legally hold 0 or 1.
13void Fuzz::next(bool* b) {
14 uint8_t n;
15 this->next(&n);
16 *b = (n & 1) == 1;
17}
18
19void Fuzz::nextBytes(void* n, size_t size) {
20 if ((fNextByte + size) > fSize) {
21 sk_bzero(n, size);
22 memcpy(n, fData + fNextByte, fSize - fNextByte);
23 fNextByte = fSize;
24 return;
25 }
26 memcpy(n, fData + fNextByte, size);
27 fNextByte += size;
28}
29
31 // See FuzzCommon.h
32 FuzzNiceRegion(this, region, 10);
33}
34
35void Fuzz::nextRange(float* f, float min, float max) {
36 this->next(f);
37 if (!std::isnormal(*f) && *f != 0.0f) {
38 // Don't deal with infinity or other strange floats.
39 *f = max;
40 }
41 *f = min + std::fmod(std::abs(*f), (max - min + 1));
42}
sk_bzero(glyphs, sizeof(glyphs))
void FuzzNiceRegion(Fuzz *fuzz, SkRegion *region, int maxN)
Definition: FuzzCommon.cpp:333
void next(T *t)
Definition: Fuzz.h:64
size_t size() const
Definition: Fuzz.h:34
void nextRange(T *, Min, Max)
Definition: Fuzz.h:119
static bool b
static float max(float r, float g, float b)
Definition: hsl.cpp:49
static float min(float r, float g, float b)
Definition: hsl.cpp:48
ClipOpAndAA opAA SkRegion region
Definition: SkRecords.h:238
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
SIN Vec< N, float > abs(const Vec< N, float > &x)
Definition: SkVx.h:707