OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "Fuzz.h" | 8 #include "Fuzz.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
11 #include "SkCommandLineFlags.h" | 11 #include "SkCommandLineFlags.h" |
12 #include "SkData.h" | 12 #include "SkData.h" |
13 #include "SkForceLinking.h" | |
14 #include "SkImage.h" | 13 #include "SkImage.h" |
15 #include "SkImageEncoder.h" | 14 #include "SkImageEncoder.h" |
16 #include "SkMallocPixelRef.h" | 15 #include "SkMallocPixelRef.h" |
17 #include "SkPicture.h" | 16 #include "SkPicture.h" |
18 #include "SkStream.h" | 17 #include "SkStream.h" |
19 | 18 |
20 #include <cmath> | 19 #include <cmath> |
21 #include <signal.h> | 20 #include <signal.h> |
22 #include <stdlib.h> | 21 #include <stdlib.h> |
23 | 22 |
24 // TODO(kjlubick): Remove once http://crrev.com/1671193002 lands | |
25 __SK_FORCE_IMAGE_DECODER_LINKING; | |
26 | |
27 DEFINE_string2(bytes, b, "", "A path to a file. This can be the fuzz bytes or a
binary to parse."); | 23 DEFINE_string2(bytes, b, "", "A path to a file. This can be the fuzz bytes or a
binary to parse."); |
28 DEFINE_string2(name, n, "", "If --type is 'api', fuzz the API with this name."); | 24 DEFINE_string2(name, n, "", "If --type is 'api', fuzz the API with this name."); |
29 | 25 |
30 DEFINE_string2(type, t, "api", "How to interpret --bytes, either 'image_scale',
'image_mode', 'skp', or 'api'."); | 26 DEFINE_string2(type, t, "api", "How to interpret --bytes, either 'image_scale',
'image_mode', 'skp', or 'api'."); |
31 DEFINE_string2(dump, d, "", "If not empty, dump 'image*' or 'skp' types as a PNG
with this name."); | 27 DEFINE_string2(dump, d, "", "If not empty, dump 'image*' or 'skp' types as a PNG
with this name."); |
32 | 28 |
33 static int printUsage(const char* name) { | 29 static int printUsage(const char* name) { |
34 SkDebugf("Usage: %s -t <type> -b <path/to/file> [-n api-to-fuzz]\n", name); | 30 SkDebugf("Usage: %s -t <type> -b <path/to/file> [-n api-to-fuzz]\n", name); |
35 return 1; | 31 return 1; |
36 } | 32 } |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 if (min > max) { | 417 if (min > max) { |
422 SkDebugf("Check mins and maxes (%f, %f)\n", min, max); | 418 SkDebugf("Check mins and maxes (%f, %f)\n", min, max); |
423 this->signalBoring(); | 419 this->signalBoring(); |
424 } | 420 } |
425 float f = std::abs(this->nextF()); | 421 float f = std::abs(this->nextF()); |
426 if (!std::isnormal(f) && f != 0.0) { | 422 if (!std::isnormal(f) && f != 0.0) { |
427 this->signalBoring(); | 423 this->signalBoring(); |
428 } | 424 } |
429 return min + fmod(f, (max - min + 1)); | 425 return min + fmod(f, (max - min + 1)); |
430 } | 426 } |
OLD | NEW |