OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 // Blacklisted typedefs | 5 // Blacklisted typedefs |
6 typedef __INTMAX_TYPE__ intmax_t; | 6 typedef __INTMAX_TYPE__ intmax_t; |
7 typedef __UINTMAX_TYPE__ uintmax_t; | 7 typedef __UINTMAX_TYPE__ uintmax_t; |
8 typedef int intptr_t; | 8 typedef int intptr_t; |
9 typedef unsigned int uintptr_t; | 9 typedef unsigned int uintptr_t; |
10 typedef __WINT_TYPE__ wint_t; | 10 typedef __WINT_TYPE__ wint_t; |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 typedef std::vector<long> long1D; | 196 typedef std::vector<long> long1D; |
197 typedef std::vector<long1D> long2D; | 197 typedef std::vector<long1D> long2D; |
198 IPC_TEST_MESSAGE(__COUNTER__, (bool, long2D)) // ERROR | 198 IPC_TEST_MESSAGE(__COUNTER__, (bool, long2D)) // ERROR |
199 | 199 |
200 IPC_TEST_MESSAGE(__COUNTER__, (char, short, std::pair<size_t, bool>)) // ERROR | 200 IPC_TEST_MESSAGE(__COUNTER__, (char, short, std::pair<size_t, bool>)) // ERROR |
201 | 201 |
202 IPC_TEST_MESSAGE(__COUNTER__, (std::vector<std::vector<long&>&>&)) // ERROR | 202 IPC_TEST_MESSAGE(__COUNTER__, (std::vector<std::vector<long&>&>&)) // ERROR |
203 | 203 |
204 | 204 |
205 /* Check IPC::WriteParam() arguments. ERRORS: 30 */ | 205 /* Check IPC::WriteParam() arguments. ERRORS: 31 */ |
206 | 206 |
207 // ERRORS: 21 | 207 // ERRORS: 21 |
208 void TestWriteParamArgument() { | 208 void TestWriteParamArgument() { |
209 #define CALL_WRITEPARAM(Type) \ | 209 #define CALL_WRITEPARAM(Type) \ |
210 { \ | 210 { \ |
211 Type p; \ | 211 Type p; \ |
212 IPC::WriteParam(nullptr, p); \ | 212 IPC::WriteParam(nullptr, p); \ |
213 } | 213 } |
214 | 214 |
215 // ERROR: blacklisted types / typedefs | 215 // ERROR: blacklisted types / typedefs |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 short short_data; | 298 short short_data; |
299 unsigned int uint_data; | 299 unsigned int uint_data; |
300 flags flags_data; | 300 flags flags_data; |
301 long long_data; | 301 long long_data; |
302 size_t size_data; | 302 size_t size_data; |
303 uint64_t uint64_data; | 303 uint64_t uint64_data; |
304 std::vector<size_t> sizes_data; | 304 std::vector<size_t> sizes_data; |
305 std::vector<uint64_t> uint64s_data; | 305 std::vector<uint64_t> uint64s_data; |
306 }; | 306 }; |
307 | 307 |
308 // ERRORS: 9 | 308 // ERRORS: 10 |
309 void TestWriteParamMemberArgument() { | 309 void TestWriteParamMemberArgument() { |
310 Provider p; | 310 Provider p; |
311 | 311 |
312 IPC::WriteParam(nullptr, p.get<short>()); // OK | 312 IPC::WriteParam(nullptr, p.get<short>()); // OK |
313 IPC::WriteParam(nullptr, p.get_short()); // OK | 313 IPC::WriteParam(nullptr, p.get_short()); // OK |
314 IPC::WriteParam(nullptr, p.short_data); // OK | 314 IPC::WriteParam(nullptr, p.short_data); // OK |
315 | 315 |
316 IPC::WriteParam(nullptr, p.get<unsigned int>()); // OK | 316 IPC::WriteParam(nullptr, p.get<unsigned int>()); // OK |
317 IPC::WriteParam(nullptr, p.get_uint()); // OK | 317 IPC::WriteParam(nullptr, p.get_uint()); // OK |
318 IPC::WriteParam(nullptr, p.uint_data); // OK | 318 IPC::WriteParam(nullptr, p.uint_data); // OK |
319 | 319 |
320 IPC::WriteParam(nullptr, p.get<Provider::flags>()); // OK | 320 IPC::WriteParam(nullptr, p.get<Provider::flags>()); // OK |
321 IPC::WriteParam(nullptr, p.get_flags()); // OK | 321 IPC::WriteParam(nullptr, p.get_flags()); // OK |
322 IPC::WriteParam(nullptr, p.flags_data); // OK | 322 IPC::WriteParam(nullptr, p.flags_data); // OK |
323 | 323 |
324 IPC::WriteParam(nullptr, p.get<long>()); // ERROR | 324 IPC::WriteParam(nullptr, p.get<long>()); // ERROR |
325 IPC::WriteParam(nullptr, p.get_long()); // ERROR | 325 IPC::WriteParam(nullptr, p.get_long()); // ERROR |
326 IPC::WriteParam(nullptr, p.long_data); // ERROR | 326 IPC::WriteParam(nullptr, p.long_data); // ERROR |
327 | 327 |
328 // This one is flaky and depends on whether size_t is typedefed to a | 328 IPC::WriteParam(nullptr, p.get<size_t>()); // ERROR |
329 // blacklisted type (unsigned long). | |
330 //IPC::WriteParam(nullptr, p.get<size_t>()); // ERROR | |
331 IPC::WriteParam(nullptr, p.get_size()); // ERROR | 329 IPC::WriteParam(nullptr, p.get_size()); // ERROR |
332 IPC::WriteParam(nullptr, p.size_data); // ERROR | 330 IPC::WriteParam(nullptr, p.size_data); // ERROR |
333 | 331 |
334 // Information about uint64_t gets lost, and plugin sees WriteParam() | 332 // Information about uint64_t gets lost, and plugin sees WriteParam() |
335 // call on unsigned long, which is blacklisted. | 333 // call on unsigned long, which is blacklisted. |
336 IPC::WriteParam(nullptr, p.get<uint64_t>()); // ERROR | 334 IPC::WriteParam(nullptr, p.get<uint64_t>()); // ERROR |
337 IPC::WriteParam(nullptr, p.get_uint64()); // OK | 335 IPC::WriteParam(nullptr, p.get_uint64()); // OK |
338 IPC::WriteParam(nullptr, p.uint64_data); // OK | 336 IPC::WriteParam(nullptr, p.uint64_data); // OK |
339 | 337 |
340 // Same thing here, WriteParam() sees vector<unsigned long>, and denies it. | 338 // Same thing here, WriteParam() sees vector<unsigned long>, and denies it. |
341 IPC::WriteParam(nullptr, p.get<std::vector<uint64_t>>()); // ERROR | 339 IPC::WriteParam(nullptr, p.get<std::vector<uint64_t>>()); // ERROR |
342 IPC::WriteParam(nullptr, p.get_uint64s()); // OK | 340 IPC::WriteParam(nullptr, p.get_uint64s()); // OK |
343 IPC::WriteParam(nullptr, p.uint64s_data); // OK | 341 IPC::WriteParam(nullptr, p.uint64s_data); // OK |
344 | 342 |
345 // This one is flaky and depends on whether size_t is typedefed to a | 343 // This one is flaky and depends on whether size_t is typedefed to a |
346 // blacklisted type (unsigned long). | 344 // blacklisted type (unsigned long). |
347 //IPC::WriteParam(nullptr, p.get<std::vector<size_t>>()); | 345 //IPC::WriteParam(nullptr, p.get<std::vector<size_t>>()); |
348 IPC::WriteParam(nullptr, p.get_sizes()); // ERROR | 346 IPC::WriteParam(nullptr, p.get_sizes()); // ERROR |
349 IPC::WriteParam(nullptr, p.sizes_data); // ERROR | 347 IPC::WriteParam(nullptr, p.sizes_data); // ERROR |
350 } | 348 } |
351 | 349 |
352 | 350 |
353 /* ERRORS: 41 */ | 351 /* ERRORS: 42 */ |
OLD | NEW |