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

Unified Diff: fuzz/FuzzScaleToSides.cpp

Issue 1617763003: Fix bounds of checking if a radii are too long for a side. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comment. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkScaleToSides.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fuzz/FuzzScaleToSides.cpp
diff --git a/fuzz/FuzzScaleToSides.cpp b/fuzz/FuzzScaleToSides.cpp
index 88a2b920b0cd483d91bc0caa96dd7db9cfe0edcf..de985622257b487d5e77ebffa89e291eec8e1252 100644
--- a/fuzz/FuzzScaleToSides.cpp
+++ b/fuzz/FuzzScaleToSides.cpp
@@ -19,23 +19,22 @@ DEF_FUZZ(ScaleToSides, fuzz) {
float radius1 = fuzz->nextF(),
radius2 = fuzz->nextF(),
width = fuzz->nextF();
- SkDebugf("%g %g %g\n", radius1, radius2, width);
if (!std::isfinite(radius1) ||
!std::isfinite(radius2) ||
- !std::isfinite(width))
+ !std::isfinite(width) ||
+ radius1 <= 0.0f ||
+ radius2 <= 0.0f ||
+ width <= 0.0f)
{
fuzz->signalBoring();
}
- if (width <= 0.0f) {
- fuzz->signalBoring();
- }
-
double scale = (double)width / ((double)radius1 + (double)radius2);
- if (scale >= 1.0) {
+ if (scale >= 1.0 || scale <= 0.0) {
fuzz->signalBoring();
}
+ SkDebugf("%g %g %g %g\n", radius1, radius2, width, scale);
ScaleToSides::AdjustRadii(width, scale, &radius1, &radius2);
// TODO(mtklein): add fuzz->keepResult()
« no previous file with comments | « no previous file | src/core/SkScaleToSides.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698