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

Unified Diff: testing/libfuzzer/fuzzers/skia_color_space_fuzzer.cc

Issue 2827573003: Skia color space fuzzer: use a locally defined Hash function (Closed)
Patch Set: Created 3 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/libfuzzer/fuzzers/skia_color_space_fuzzer.cc
diff --git a/testing/libfuzzer/fuzzers/skia_color_space_fuzzer.cc b/testing/libfuzzer/fuzzers/skia_color_space_fuzzer.cc
index 850f73f4679501ed7129417070bc9b82c88ff9fe..c53f47424ab019046dfee9f44f9bca6f6794a0ad 100644
--- a/testing/libfuzzer/fuzzers/skia_color_space_fuzzer.cc
+++ b/testing/libfuzzer/fuzzers/skia_color_space_fuzzer.cc
@@ -7,7 +7,6 @@
#include <random>
#include "base/logging.h"
-#include "base/strings/string_piece.h"
#include "testing/libfuzzer/fuzzers/color_space_data.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkColorSpaceXform.h"
@@ -63,8 +62,10 @@ static sk_sp<SkColorSpace> SelectProfile(size_t hash) {
return profiles[hash & 7];
}
-inline size_t Hash(const char* data, size_t size) {
- return base::StringPieceHash()(base::StringPiece(data, size));
+inline size_t Hash(const char* data, size_t size, size_t hash = ~0) {
+ for (size_t i = 0; i < size; ++i)
+ hash = hash * 131 + *data++;
+ return hash;
}
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698