/src/httrack/fuzz/fuzz-idna.c
Line | Count | Source |
1 | | /* ------------------------------------------------------------ */ |
2 | | /* |
3 | | HTTrack Website Copier, Offline Browser for Windows and Unix |
4 | | Copyright (C) 1998 Xavier Roche and other contributors |
5 | | |
6 | | SPDX-License-Identifier: GPL-3.0-or-later |
7 | | |
8 | | This program is free software: you can redistribute it and/or modify |
9 | | it under the terms of the GNU General Public License as published by |
10 | | the Free Software Foundation, either version 3 of the License, or |
11 | | (at your option) any later version. |
12 | | |
13 | | This program is distributed in the hope that it will be useful, |
14 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | | GNU General Public License for more details. |
17 | | |
18 | | You should have received a copy of the GNU General Public License |
19 | | along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | | |
21 | | Ethical use: we kindly ask that you NOT use this software to harvest email |
22 | | addresses or to collect any other private information about people. Doing so |
23 | | would dishonor our work and waste the many hours we have spent on it. |
24 | | |
25 | | Please visit our Website: http://www.httrack.com |
26 | | */ |
27 | | |
28 | | /* Fuzz the IDNA/punycode codec (htscharset.c, CVE-prone lineage). */ |
29 | | #include "fuzz.h" |
30 | | #include "htscharset.h" |
31 | | |
32 | 1.98k | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { |
33 | 1.98k | char *s = fuzz_strdup(data, size); |
34 | | |
35 | 1.98k | { |
36 | 1.98k | char *idna = hts_convertStringUTF8ToIDNA(s, size); |
37 | 1.98k | freet(idna); |
38 | 1.98k | } |
39 | 1.98k | { |
40 | 1.98k | char *utf8 = hts_convertStringIDNAToUTF8(s, size); |
41 | 1.98k | freet(utf8); |
42 | 1.98k | } |
43 | 1.98k | (void) hts_isStringIDNA(s, size); |
44 | | |
45 | | freet(s); |
46 | 1.98k | return 0; |
47 | 1.98k | } |