1 // 2 // Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021 3 // 4 // Distributed under the Boost Software License, Version 1.0. (See accompanying 5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 // 7 #include "td/telegram/MessageEntity.h" 8 9 #include "td/utils/common.h" 10 #include "td/utils/logging.h" 11 #include "td/utils/Slice.h" 12 13 #include <cstddef> 14 #include <cstdint> 15 get_utf_string(td::Slice from)16static td::string get_utf_string(td::Slice from) { 17 td::string res; 18 td::string alph = " ab@./01#"; 19 for (auto c : from) { 20 res += alph[static_cast<td::uint8>(c) % alph.size()]; 21 } 22 LOG(ERROR) << res; 23 return res; 24 } 25 LLVMFuzzerTestOneInput(std::uint8_t * data,std::size_t data_size)26extern "C" int LLVMFuzzerTestOneInput(std::uint8_t *data, std::size_t data_size) { 27 td::find_urls(get_utf_string(td::Slice(data, data_size))); 28 //td::find_hashtags(get_utf_string(td::Slice(data, data_size))); 29 //td::find_bot_commands(get_utf_string(td::Slice(data, data_size))); 30 //td::is_email_address(get_utf_string(td::Slice(data, data_size))); 31 //td::find_mentions(get_utf_string(td::Slice(data, data_size))); 32 return 0; 33 } 34