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

Unified Diff: fuzz/FuzzParsePath.cpp

Issue 2478593003: Avoid params being initialized out of order in Fuzzer (Closed)
Patch Set: Created 4 years, 1 month 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 | « fuzz/FuzzGradients.cpp ('k') | fuzz/FuzzPathop.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fuzz/FuzzParsePath.cpp
diff --git a/fuzz/FuzzParsePath.cpp b/fuzz/FuzzParsePath.cpp
index 1a597d87a0fb422c40b2b498eed6fccb454a398c..cb924c479ac74de637baa435ba07bc11d4ff4492 100644
--- a/fuzz/FuzzParsePath.cpp
+++ b/fuzz/FuzzParsePath.cpp
@@ -39,9 +39,9 @@ static void add_white(Fuzz* fuzz, SkString* atom) {
atom->append(" ");
return;
}
- int reps = fuzz->nextRange(0, 2);
+ int reps; fuzz->nextRange(&reps, 0, 2);
for (int rep = 0; rep < reps; ++rep) {
- int index = fuzz->nextRange(0, (int) SK_ARRAY_COUNT(gWhiteSpace) - 1);
+ int index; fuzz->nextRange(&index, 0, (int) SK_ARRAY_COUNT(gWhiteSpace) - 1);
if (gWhiteSpace[index]) {
atom->append(&gWhiteSpace[index], 1);
}
@@ -60,7 +60,8 @@ static void add_comma(Fuzz* fuzz, SkString* atom) {
return;
}
add_white(fuzz, atom);
- if (fuzz->next<bool>()) {
+ bool b; fuzz->next(&b);
+ if (b) {
atom->append(",");
}
add_some_white(fuzz, atom);
@@ -68,15 +69,16 @@ static void add_comma(Fuzz* fuzz, SkString* atom) {
SkString MakeRandomParsePathPiece(Fuzz* fuzz) {
SkString atom;
- int index = fuzz->nextRange(0, (int) SK_ARRAY_COUNT(gLegal) - 1);
+ int index; fuzz->nextRange(&index, 0, (int) SK_ARRAY_COUNT(gLegal) - 1);
const Legal& legal = gLegal[index];
gEasy ? atom.append("\n") : add_white(fuzz, &atom);
- char symbol = legal.fSymbol | (fuzz->next<bool>() ? 0x20 : 0);
+ bool b; fuzz->next(&b);
+ char symbol = legal.fSymbol | (b ? 0x20 : 0);
atom.append(&symbol, 1);
- int reps = fuzz->nextRange(1, 3);
+ int reps; fuzz->nextRange(&reps, 1, 3);
for (int rep = 0; rep < reps; ++rep) {
for (int index = 0; index < legal.fScalars; ++index) {
- SkScalar coord = fuzz->nextRange(0.0f, 100.0f);
+ SkScalar coord; fuzz->nextRange(&coord, 0.0f, 100.0f);
add_white(fuzz, &atom);
atom.appendScalar(coord);
if (rep < reps - 1 && index < legal.fScalars - 1) {
@@ -85,11 +87,14 @@ SkString MakeRandomParsePathPiece(Fuzz* fuzz) {
add_some_white(fuzz, &atom);
}
if ('A' == legal.fSymbol && 1 == index) {
- atom.appendScalar(fuzz->nextRange(-720.0f, 720.0f));
+ SkScalar s; fuzz->nextRange(&s, -720.0f, 720.0f);
+ atom.appendScalar(s);
add_comma(fuzz, &atom);
- atom.appendU32(fuzz->nextRange(0, 1));
+ int i; fuzz->nextRange(&i, 0, 1);
+ atom.appendU32(i);
add_comma(fuzz, &atom);
- atom.appendU32(fuzz->nextRange(0, 1));
+ fuzz->nextRange(&i, 0, 1);
+ atom.appendU32(i);
add_comma(fuzz, &atom);
}
}
@@ -100,8 +105,8 @@ SkString MakeRandomParsePathPiece(Fuzz* fuzz) {
DEF_FUZZ(ParsePath, fuzz) {
SkPath path;
SkString spec;
- uint32_t count = fuzz->nextRange(0, 40);
- for (uint32_t i = 0; i < count; ++i) {
+ int count; fuzz->nextRange(&count, 0, 40);
+ for (int i = 0; i < count; ++i) {
spec.append(MakeRandomParsePathPiece(fuzz));
}
SkDebugf("SkParsePath::FromSVGString(%s, &path);\n",spec.c_str());
« no previous file with comments | « fuzz/FuzzGradients.cpp ('k') | fuzz/FuzzPathop.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698