| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <iostream> | 5 #include <iostream> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 148 |
| 149 template <> | 149 template <> |
| 150 struct FuzzTraits<unsigned short> { | 150 struct FuzzTraits<unsigned short> { |
| 151 static bool Fuzz(unsigned short* p, Fuzzer* fuzzer) { | 151 static bool Fuzz(unsigned short* p, Fuzzer* fuzzer) { |
| 152 fuzzer->FuzzUInt16(reinterpret_cast<uint16_t*>(p)); | 152 fuzzer->FuzzUInt16(reinterpret_cast<uint16_t*>(p)); |
| 153 return true; | 153 return true; |
| 154 } | 154 } |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 template <> | 157 template <> |
| 158 struct FuzzTraits<char> { | 158 struct FuzzTraits<signed char> { |
| 159 static bool Fuzz(char* p, Fuzzer* fuzzer) { | 159 static bool Fuzz(signed char* p, Fuzzer* fuzzer) { |
| 160 fuzzer->FuzzUChar(reinterpret_cast<unsigned char*>(p)); | 160 fuzzer->FuzzUChar(reinterpret_cast<unsigned char*>(p)); |
| 161 return true; | 161 return true; |
| 162 } | 162 } |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 template <> | 165 template <> |
| 166 struct FuzzTraits<unsigned char> { | 166 struct FuzzTraits<unsigned char> { |
| 167 static bool Fuzz(unsigned char* p, Fuzzer* fuzzer) { | 167 static bool Fuzz(unsigned char* p, Fuzzer* fuzzer) { |
| 168 fuzzer->FuzzUChar(p); | 168 fuzzer->FuzzUChar(p); |
| 169 return true; | 169 return true; |
| (...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1423 static_cast<media::ChannelLayout>(channel_layout), sample_rate, | 1423 static_cast<media::ChannelLayout>(channel_layout), sample_rate, |
| 1424 bits_per_sample, frames_per_buffer); | 1424 bits_per_sample, frames_per_buffer); |
| 1425 params.set_channels_for_discrete(channels); | 1425 params.set_channels_for_discrete(channels); |
| 1426 params.set_effects(effects); | 1426 params.set_effects(effects); |
| 1427 *p = params; | 1427 *p = params; |
| 1428 return true; | 1428 return true; |
| 1429 } | 1429 } |
| 1430 }; | 1430 }; |
| 1431 | 1431 |
| 1432 template <> | 1432 template <> |
| 1433 struct FuzzTraits<media::cast::RtpTimeTicks> { |
| 1434 static bool Fuzz(media::cast::RtpTimeTicks* p, Fuzzer* fuzzer) { |
| 1435 base::TimeDelta delta; |
| 1436 int base; |
| 1437 if (!FuzzParam(&delta, fuzzer)) |
| 1438 return false; |
| 1439 if (!FuzzParam(&base, fuzzer)) |
| 1440 return false; |
| 1441 *p = media::cast::RtpTimeTicks::FromTimeDelta(delta, base); |
| 1442 return true; |
| 1443 } |
| 1444 }; |
| 1445 |
| 1446 template <> |
| 1433 struct FuzzTraits<media::VideoCaptureFormat> { | 1447 struct FuzzTraits<media::VideoCaptureFormat> { |
| 1434 static bool Fuzz(media::VideoCaptureFormat* p, Fuzzer* fuzzer) { | 1448 static bool Fuzz(media::VideoCaptureFormat* p, Fuzzer* fuzzer) { |
| 1435 if (!FuzzParam(&p->frame_size, fuzzer)) | 1449 if (!FuzzParam(&p->frame_size, fuzzer)) |
| 1436 return false; | 1450 return false; |
| 1437 if (!FuzzParam(&p->frame_rate, fuzzer)) | 1451 if (!FuzzParam(&p->frame_rate, fuzzer)) |
| 1438 return false; | 1452 return false; |
| 1439 if (!FuzzParam(reinterpret_cast<int*>(&p->pixel_format), fuzzer)) | 1453 if (!FuzzParam(reinterpret_cast<int*>(&p->pixel_format), fuzzer)) |
| 1440 return false; | 1454 return false; |
| 1441 return true; | 1455 return true; |
| 1442 } | 1456 } |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2129 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" | 2143 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" |
| 2130 #undef IPC_MESSAGE_DECL | 2144 #undef IPC_MESSAGE_DECL |
| 2131 #define IPC_MESSAGE_DECL(name, ...) \ | 2145 #define IPC_MESSAGE_DECL(name, ...) \ |
| 2132 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz; | 2146 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz; |
| 2133 | 2147 |
| 2134 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) { | 2148 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) { |
| 2135 #include "tools/ipc_fuzzer/message_lib/all_messages.h" | 2149 #include "tools/ipc_fuzzer/message_lib/all_messages.h" |
| 2136 } | 2150 } |
| 2137 | 2151 |
| 2138 } // namespace ipc_fuzzer | 2152 } // namespace ipc_fuzzer |
| OLD | NEW |