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

Unified Diff: tools/ipc_fuzzer/mutate/generate.cc

Issue 932103003: Add support for more param traits in ipc fuzzer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: generate random value for type Created 5 years, 10 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: tools/ipc_fuzzer/mutate/generate.cc
diff --git a/tools/ipc_fuzzer/mutate/generate.cc b/tools/ipc_fuzzer/mutate/generate.cc
index 6d8137dd2ac24c8b15925de4036af0f0d054afd6..ba3dc997eac2b2e83d6179d4e98184de74d31d03 100644
--- a/tools/ipc_fuzzer/mutate/generate.cc
+++ b/tools/ipc_fuzzer/mutate/generate.cc
@@ -1040,18 +1040,23 @@ struct GenerateTraits<content::SyntheticGesturePacket> {
template <>
struct GenerateTraits<content::WebCursor> {
static bool Generate(content::WebCursor* p, Generator* generator) {
- blink::WebCursorInfo::Type type;
- if (!GenerateParam(&type, generator))
- return false;
- content::WebCursor::CursorInfo info(type);
+ content::WebCursor::CursorInfo info;
- // Omitting |externalHandle| since it is not serialized.
+ // |type| enum is not validated on de-serialization, so pick random value.
+ if (!GenerateParam(reinterpret_cast<int *>(&info.type), generator))
+ return false;
if (!GenerateParam(&info.hotspot, generator))
return false;
if (!GenerateParam(&info.image_scale_factor, generator))
return false;
if (!GenerateParam(&info.custom_image, generator))
return false;
+ // Omitting |externalHandle| since it is not serialized.
+
+ // Scale factor is expected to be greater than 0, otherwise we hit
+ // a check failure.
+ info.image_scale_factor = fabs(info.image_scale_factor) + 0.001;
+
*p = content::WebCursor(info);
return true;
}
@@ -1290,6 +1295,16 @@ struct GenerateTraits<GURL> {
}
};
+#if defined(OS_WIN)
+template <>
+struct GenerateTraits<HWND> {
+ static bool Generate(HWND* p, Generator* generator) {
+ // TODO(aarya): This should actually generate something.
+ return true;
+ }
+};
+#endif
+
template <>
struct GenerateTraits<IPC::Message> {
static bool Generate(IPC::Message *p, Generator* generator) {
@@ -1330,6 +1345,16 @@ struct GenerateTraits<IPC::ChannelHandle> {
}
};
+#if defined(OS_WIN)
+template <>
+struct GenerateTraits<LOGFONT> {
+ static bool Generate(LOGFONT* p, Generator* generator) {
+ // TODO(aarya): This should actually generate something.
+ return true;
+ }
+};
+#endif
+
template <>
struct GenerateTraits<media::AudioParameters> {
static bool Generate(media::AudioParameters* p, Generator* generator) {
« 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