1 // Copyright 2015 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifdef UNSAFE_BUFFERS_BUILD 6 // TODO(crbug.com/40284755): Remove this and spanify to fix the errors. 7 #pragma allow_unsafe_buffers 8 #endif 9 10 #include <stddef.h> 11 #include <stdint.h> 12 13 #include <string> 14 15 #include "base/strings/escape.h" 16 17 static const int kMaxUnescapeRule = 31; 18 19 // Entry point for LibFuzzer. LLVMFuzzerTestOneInput(const uint8_t * data,size_t size)20extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 21 std::string_view path(reinterpret_cast<const char*>(data), size); 22 for (int i = 0; i <= kMaxUnescapeRule; i++) { 23 base::UnescapeURLComponent(path, static_cast<base::UnescapeRule::Type>(i)); 24 } 25 26 return 0; 27 } 28