matching_fuzzer.cc 879 B

1234567891011121314151617181920212223242526272829
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "third_party/zxcvbn-cpp/native-src/zxcvbn/matching.hpp"
  5. #include <stddef.h>
  6. #include <stdint.h>
  7. #include <string>
  8. #include "base/strings/string_util.h"
  9. extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
  10. std::string password(reinterpret_cast<const char*>(data), size);
  11. if (!base::IsStringUTF8(password))
  12. return 0;
  13. zxcvbn::dictionary_match(password, {});
  14. zxcvbn::reverse_dictionary_match(password, {});
  15. zxcvbn::l33t_match(password, {}, {});
  16. zxcvbn::spatial_match(password, {});
  17. zxcvbn::repeat_match(password);
  18. zxcvbn::sequence_match(password);
  19. zxcvbn::regex_match(password, {});
  20. zxcvbn::date_match(password);
  21. zxcvbn::omnimatch(password);
  22. return 0;
  23. }