Line data Source code
1 : /* tst_utf8crash.c --- Self tests for malformed UTF-8 regressions. 2 : * Copyright (C) 2015-2020 Simon Josefsson 3 : * 4 : * This file is part of GNU Libidn. 5 : * 6 : * This program is free software: you can redistribute it and/or modify 7 : * it under the terms of the GNU General Public License as published by 8 : * the Free Software Foundation, either version 3 of the License, or 9 : * (at your option) any later version. 10 : * 11 : * This program is distributed in the hope that it will be useful, 12 : * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 : * GNU General Public License for more details. 15 : * 16 : * You should have received a copy of the GNU General Public License 17 : * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 : * 19 : */ 20 : 21 : #ifdef HAVE_CONFIG_H 22 : # include "config.h" 23 : #endif 24 : 25 : #include <stdio.h> 26 : #include <stdlib.h> 27 : #include <stdarg.h> 28 : #include <string.h> 29 : 30 : #include <idna.h> 31 : #include <idn-free.h> 32 : 33 : #include "utils.h" 34 : 35 : /* Based on report from Adam Sampson: 36 : https://lists.gnu.org/archive/html/help-libidn/2015-07/msg00026.html */ 37 : 38 : void 39 1 : doit (void) 40 : { 41 1 : const char input[] = "200円bad.com"; 42 : char *output; 43 : int rc; 44 : 45 1 : rc = idna_to_unicode_8z8z (input, &output, 0); 46 1 : if (rc != IDNA_ICONV_ERROR) 47 0 : fail ("rc %d\n", rc); 48 1 : }