Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: fuzz/FuzzScaleToSides.cpp

Issue 1611293002: Demo fuzz for Herb (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gyp/fuzz.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 // Reminder of how to run:
9 // $ env CC=afl-clang CXX=afl-clang++ ./gyp_skia
10 // $ ninja -C out/Debug fuzz
11 // $ afl-fuzz -i fuzz-in -o fuzz-out out/Debug/fuzz -n ScaleToSides -b @@
12 // where you seed fuzz-in/ with one or more small files.
13
14 #include "Fuzz.h"
15 #include "SkScaleToSides.h"
16 #include <cmath>
17
18 DEF_FUZZ(ScaleToSides, fuzz) {
19 float radius1 = fuzz->nextF(),
20 radius2 = fuzz->nextF(),
21 width = fuzz->nextF();
22 SkDebugf("%g %g %g\n", radius1, radius2, width);
23
24 if (!std::isfinite(radius1) ||
kjlubick 2016/01/21 17:17:52 Why not std::isnormal(), which accounts for infini
mtklein 2016/01/21 17:37:46 Zeros and subnormals should work for some of these
herb_g 2016/01/21 17:38:20 What he said.
25 !std::isfinite(radius2) ||
26 !std::isfinite(width))
27 {
28 fuzz->signalBoring();
29 }
30
31 if (width <= 0.0f) {
32 fuzz->signalBoring();
33 }
34
35 double scale = (double)width / ((double)radius1 + (double)radius2);
36 if (scale >= 1.0) {
37 fuzz->signalBoring();
38 }
39 ScaleToSides::AdjustRadii(width, scale, &radius1, &radius2);
40
41 // TODO(mtklein): add fuzz->keepResult()
42 volatile float junk = 0.0f;
43 junk *= radius1;
44 junk *= radius2;
45 }
OLDNEW
« no previous file with comments | « no previous file | gyp/fuzz.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698