bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: inetutils-2.2 released [stable]


From: Michael Brunnbauer
Subject: Re: inetutils-2.2 released [stable]
Date: Mon, 13 Sep 2021 11:44:25 +0200

Hello Simon,

here is a minimal example. This looks more like a bug in glibc:

#define _GNU_SOURCE 1

#include <regex.h>
#include <locale.h>
#include <limits.h>
#include <string.h>
#include <signal.h>
#include <unistd.h>
#include <malloc.h>

int main()
{
            static struct re_pattern_buffer regex;
            int i;
            const char *s;
            struct re_registers regs;

            /* glibc bug 11053.  */
            re_set_syntax (RE_SYNTAX_POSIX_BASIC);
            memset (&regex, 0, sizeof regex);
            static char const pat_sub2[] = "\\(a*\\)*a*\\1";
            s = re_compile_pattern (pat_sub2, sizeof pat_sub2 - 1, &regex);
            if (s) return 123;
            memset (&regs, 0, sizeof regs);
            static char const data[] = "a";
            int datalen = sizeof data - 1;
            i = re_search (&regex, data, datalen, 0, datalen, &regs);
            return 0;
}

Regards,

Michael Brunnbauer

On Mon, Sep 13, 2021 at 11:02:49AM +0200, Michael Brunnbauer wrote:
> 
> Hello Simon,
> 
> On Fri, Sep 10, 2021 at 01:22:50PM +0200, Simon Josefsson wrote:
> > Could you try to reproduce the problem standalone?  The file regexp.m4
> > contains the C code to trigger the bug,
> 
> Not usable. But configure actually dumps the code in config.log - I extracted
> it from there.
> 
> > could you extract it and build it separately and run it under gdb and get a 
> > 'bt full' backtrace?
> 
> Sourcecode is attached. It was compiled with "gcc -o test -g -O2 test.c".
> Here is the backtrace:
> 
> gdb test
> GNU gdb (GDB) 9.1
> Copyright (C) 2020 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> Type "show copying" and "show warranty" for details.
> This GDB was configured as "x86_64-pc-linux-gnu".
> Type "show configuration" for configuration details.
> For bug reporting instructions, please see:
> <http://www.gnu.org/software/gdb/bugs/>.
> Find the GDB manual and other documentation resources online at:
>     <http://www.gnu.org/software/gdb/documentation/>.
> 
> For help, type "help".
> Type "apropos word" to search for commands related to "word"...
> Reading symbols from test...
> (gdb) run
> Starting program: /home/bold/GNU/inetutils-2.2/test
> 
> Program received signal SIGSEGV, Segmentation fault.
> memcpy@GLIBC_2.2.5 ()
>     at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:208
> 208             VMOVU   (%rsi), %VEC(0)
> (gdb) bt full
> #0  memcpy@GLIBC_2.2.5 ()
>     at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:208
> No locals.
> #1  0x00007ffff7e9f1b6 in pop_fail_stack (fs=fs@entry=0x7fffffffe0a0,
>     pidx=pidx@entry=0x7fffffffe08c, nregs=nregs@entry=2,
>     regs=regs@entry=0x406da0, 
> eps_via_nodes=eps_via_nodes@entry=0x7fffffffe090)
>     at regexec.c:1351
>         num = <optimized out>
> #2  0x00007ffff7eaa271 in set_regs (fl_backtrack=<optimized out>,
>     pmatch=0x406da0, nmatch=2, mctx=0x7fffffffe150, preg=0x406cb0)
>     at regexec.c:1449
>         dfa = <optimized out>
>         idx = 0
>         eps_via_nodes = {alloc = 2, nelem = 1, elems = 0x40b340}
>         cur_node = <optimized out>
>         fs = 0x7fffffffe0a0
>         fs_body = {num = -1, alloc = 4, stack = 0x40ba30}
>         prev_match = {u = {dynarray_abstract = {used = 2, allocated = 16,
>               array = 0x7fffffffe0c8}, dynarray_header = {used = 2,
>               allocated = 16, array = 0x7fffffffe0c8}}, scratch = {{rm_so = 0,
>               rm_eo = 1}, {rm_so = 0, rm_eo = 1}, {rm_so = 2, rm_eo = 0}, {
>               rm_so = 16, rm_eo = 0}, {rm_so = 4236744, rm_eo = 0}, {
>               rm_so = 4236720, rm_eo = 0}, {rm_so = 4222128, rm_eo = 0}, {
>               rm_so = 50, rm_eo = 0}, {rm_so = -135964009, rm_eo = 32767}, {
>               rm_so = 4222912, rm_eo = 0}, {rm_so = 4236744, rm_eo = 0}, {
>               rm_so = 4236720, rm_eo = 0}, {rm_so = 2, rm_eo = 0}, {
>               rm_so = 4222912, rm_eo = 0}, {rm_so = -135668317,
>               rm_eo = 32767}, {rm_so = 0, rm_eo = 1}}}
>         prev_idx_match = <optimized out>
>         dfa = <optimized out>
>         idx = <optimized out>
>         cur_node = <optimized out>
>         eps_via_nodes = <optimized out>
>         fs = <optimized out>
>         fs_body = <optimized out>
>         prev_match = <optimized out>
>         prev_idx_match = <optimized out>
>         reg_idx = <optimized out>
> #3  re_search_internal (preg=preg@entry=0x4040a0 <regex>,
>     string=string@entry=0x402080 <data> "a", length=length@entry=1,
>     start=<optimized out>, start@entry=0, last_start=<optimized out>,
>     last_start@entry=1, stop=stop@entry=1, nmatch=2, pmatch=0x406da0, 
> eflags=0)
>     at regexec.c:849
>         reg_idx = <optimized out>
>         err = _REG_NOERROR
>         dfa = 0x406cb0
>         left_lim = 0
>         right_lim = 1
>         incr = 1
>         fl_longest_match = <optimized out>
>         match_kind = 8
>         match_first = 0
>         match_last = <optimized out>
>         extra_nmatch = 0
>         sb = true
>         ch = <optimized out>
>         mctx = {input = {raw_mbs = 0x402080 <data> "a",
>             mbs = 0x402080 <data> "a", wcs = 0x0, offsets = 0x0, cur_state = {
>               __count = 0, __value = {__wch = 0, __wchb = "\000\000\000"}},
>             raw_mbs_idx = 0, valid_len = 1, valid_raw_len = 1, bufs_len = 2,
>             cur_idx = 1, raw_len = 1, len = 1, raw_stop = 1, stop = 1,
>             tip_context = 6, trans = 0x0, word_char = 0x406d58,
>             icase = 0 '\000', is_utf8 = 0 '\000', map_notascii = 0 '\000',
>             mbs_allocated = 0 '\000', offsets_needed = 0 '\000',
>             newline_anchor = 1 '\001', word_ops_used = 0 '\000',
>             mb_cur_max = 1}, dfa = 0x406cb0, eflags = 0, match_last = 1,
>           last_node = 8, state_log = 0x40b300, state_log_top = 1,
>           nbkref_ents = 3, abkref_ents = 4, bkref_ents = 0x40b130,
>           max_mb_elem_len = 0, nsub_tops = 2, asub_tops = 2,
>           sub_tops = 0x406400}
>         fastmap = 0x0
>         t = <optimized out>
> #4  0x00007ffff7eab8a2 in re_search_stub (bufp=bufp@entry=0x4040a0 <regex>,
>     string=string@entry=0x402080 <data> "a", length=length@entry=1,
>     start=start@entry=0, range=range@entry=1, stop=stop@entry=1,
>     regs=0x7fffffffe300, ret_len=false) at regexec.c:425
>         result = <optimized out>
>         pmatch = 0x406da0
>         nregs = 2
>         rval = <optimized out>
>         eflags = <optimized out>
>         dfa = <optimized out>
>         last_start = <optimized out>
> #5  0x00007ffff7eac1a0 in __re_search (bufp=bufp@entry=0x4040a0 <regex>,
>     string=string@entry=0x402080 <data> "a", length=length@entry=1,
>     start=start@entry=0, range=range@entry=1, regs=regs@entry=0x7fffffffe300)
>     at regexec.c:289
> No locals.
> #6  0x000000000040151b in main () at test1.c:650
>         data = "a"
>         datalen = 1
>         result = 0
>         regex = {buffer = 0x406cb0, allocated = 224, used = 224,
>           syntax = 16843462, fastmap = 0x0, translate = 0x0, re_nsub = 1,
>           can_be_null = 0, regs_allocated = 0, fastmap_accurate = 0,
>           no_sub = 0, not_bol = 0, not_eol = 0, newline_anchor = 1}
>         folded_chars = 
> "\000\001\002\003\004\005\006\a\b\t\n\v\f\r\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037
>  
> !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237
>  ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇ"...
>         i = <optimized out>
>         s = <optimized out>
>         regs = {num_regs = 0, start = 0x0, end = 0x0}
>         pat_sub2 = "\\(a*\\)*a*\\1"
> 
> Regards,
> 
> Michael Brunnbauer
> 
> -- 
> ++  Michael Brunnbauer
> ++  netEstate GmbH
> ++  Geisenhausener Straße 11a
> ++  81379 München
> ++  Tel +49 89 32 19 77 80
> ++  Fax +49 89 32 19 77 89 
> ++  E-Mail brunni@netestate.de
> ++  https://www.netestate.de/
> ++
> ++  Sitz: München, HRB Nr.142452 (Handelsregister B München)
> ++  USt-IdNr. DE221033342
> ++  Geschäftsführer: Michael Brunnbauer, Franz Brunnbauer
> ++  Prokurist: Dipl. Kfm. (Univ.) Markus Hendel

> /* confdefs.h */
> #define PACKAGE_NAME "GNU inetutils"
> #define PACKAGE_TARNAME "inetutils"
> #define PACKAGE_VERSION "2.2"
> #define PACKAGE_STRING "GNU inetutils 2.2"
> #define PACKAGE_BUGREPORT "bug-inetutils@gnu.org"
> #define PACKAGE_URL "http://www.gnu.org/software/inetutils/";
> #define PACKAGE "inetutils"
> #define VERSION "2.2"
> #define STDC_HEADERS 1
> #define HAVE_SYS_TYPES_H 1
> #define HAVE_SYS_STAT_H 1
> #define HAVE_STDLIB_H 1
> #define HAVE_STRING_H 1
> #define HAVE_MEMORY_H 1
> #define HAVE_STRINGS_H 1
> #define HAVE_INTTYPES_H 1
> #define HAVE_STDINT_H 1
> #define HAVE_UNISTD_H 1
> #define HAVE_WCHAR_H 1
> #define HAVE_FEATURES_H 1
> #define HAVE_ARPA_INET_H 1
> #define HAVE_SYS_SOCKET_H 1
> #define HAVE_UNISTD_H 1
> #define HAVE_SYS_PARAM_H 1
> #define HAVE_DIRENT_H 1
> #define HAVE_FNMATCH_H 1
> #define HAVE_PTY_H 1
> #define HAVE_TERMIOS_H 1
> #define HAVE_SYS_STAT_H 1
> #define HAVE_SYS_VFS_H 1
> #define HAVE_NETDB_H 1
> #define HAVE_NETINET_IN_H 1
> #define HAVE_GETOPT_H 1
> #define HAVE_SYS_CDEFS_H 1
> #define HAVE_STDIO_EXT_H 1
> #define HAVE_GRP_H 1
> #define HAVE_GLOB_H 1
> #define HAVE_THREADS_H 1
> #define HAVE_LIMITS_H 1
> #define HAVE_INTTYPES_H 1
> #define HAVE_SYS_TYPES_H 1
> #define HAVE_STDINT_H 1
> #define HAVE_LANGINFO_H 1
> #define HAVE_SYS_MMAN_H 1
> #define HAVE_POLL_H 1
> #define HAVE_SYS_IOCTL_H 1
> #define HAVE_UTMP_H 1
> #define HAVE_UTMPX_H 1
> #define HAVE_MALLOC_H 1
> #define HAVE_SYS_SELECT_H 1
> #define HAVE_SYS_TIME_H 1
> #define HAVE_STRINGS_H 1
> #define HAVE_SYS_RANDOM_H 1
> #define HAVE_SYS_UIO_H 1
> #define HAVE_SYSEXITS_H 1
> #define HAVE_WCTYPE_H 1
> #define HAVE_STDLIB_H 1
> #define _ALL_SOURCE 1
> #define _DARWIN_C_SOURCE 1
> #define _GNU_SOURCE 1
> #define _HPUX_ALT_XOPEN_SOCKET_API 1
> #define _NETBSD_SOURCE 1
> #define _OPENBSD_SOURCE 1
> #define _POSIX_PTHREAD_SEMANTICS 1
> #define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1
> #define __STDC_WANT_IEC_60559_BFP_EXT__ 1
> #define __STDC_WANT_IEC_60559_DFP_EXT__ 1
> #define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1
> #define __STDC_WANT_IEC_60559_TYPES_EXT__ 1
> #define __STDC_WANT_LIB_EXT2__ 1
> #define __STDC_WANT_MATH_SPEC_FUNCS__ 1
> #define _TANDEM_SOURCE 1
> #define __EXTENSIONS__ 1
> #define HAVE_FSEEKO 1
> #define HAVE_ALLOCA_H 1
> #define HAVE_ALLOCA 1
> #define restrict __restrict__
> #define HAVE_DECL_CLEARERR_UNLOCKED 1
> #define HAVE_DECL_FEOF_UNLOCKED 1
> #define HAVE_DECL_FERROR_UNLOCKED 1
> #define HAVE_DECL_FFLUSH_UNLOCKED 1
> #define HAVE_DECL_FGETS_UNLOCKED 1
> #define HAVE_DECL_FPUTC_UNLOCKED 1
> #define HAVE_DECL_FPUTS_UNLOCKED 1
> #define HAVE_DECL_FREAD_UNLOCKED 1
> #define HAVE_DECL_FWRITE_UNLOCKED 1
> #define HAVE_DECL_GETC_UNLOCKED 1
> #define HAVE_DECL_GETCHAR_UNLOCKED 1
> #define HAVE_DECL_PUTC_UNLOCKED 1
> #define HAVE_DECL_PUTCHAR_UNLOCKED 1
> #define HAVE_FLOCKFILE 1
> #define HAVE_FUNLOCKFILE 1
> #define HAVE_BTOWC 1
> #define HAVE_FCHDIR 1
> #define HAVE_EXPLICIT_BZERO 1
> #define HAVE_FCNTL 1
> #define HAVE_SYMLINK 1
> #define HAVE_FDOPENDIR 1
> #define HAVE_MEMPCPY 1
> #define HAVE_FNMATCH 1
> #define HAVE_MBSRTOWCS 1
> #define HAVE_FSTATAT 1
> #define HAVE_OPENAT 1
> #define HAVE_FSTATFS 1
> #define HAVE_GETDELIM 1
> #define HAVE_GETDTABLESIZE 1
> #define HAVE_GETLOGIN_R 1
> #define HAVE_GETPASS 1
> #define HAVE___FSETLOCKING 1
> #define HAVE_GETRANDOM 1
> #define HAVE_GETUSERSHELL 1
> #define HAVE_GLOB 1
> #define HAVE_GLOB_PATTERN_P 1
> #define HAVE_GETPWNAM_R 1
> #define HAVE_ISBLANK 1
> #define HAVE_LSTAT 1
> #define HAVE_MBSINIT 1
> #define HAVE_MBRTOWC 1
> #define HAVE_MPROTECT 1
> #define HAVE_GETGROUPLIST 1
> #define HAVE_MKSTEMP 1
> #define HAVE_NL_LANGINFO 1
> #define HAVE_PIPE 1
> #define HAVE_POSIX_OPENPT 1
> #define HAVE_UTMPNAME 1
> #define HAVE_UTMPXNAME 1
> #define HAVE_ISWCTYPE 1
> #define HAVE_SETENV 1
> #define HAVE_SLEEP 1
> #define HAVE_SNPRINTF 1
> #define HAVE_STRNDUP 1
> #define HAVE_WCRTOMB 1
> #define HAVE_ISWCNTRL 1
> #define HAVE_WMEMPCPY 1
> #define HAVE_DECL_STRERROR_R 1
> #define HAVE_STRERROR_R 1
> #define STRERROR_R_CHAR_P 1
> #define HAVE_LANGINFO_CODESET 1
> #define HAVE_MALLOC_POSIX 1
> #define HAVE_ENVIRON_DECL 1
> #define HAVE_DECL_FCHDIR 1
> #define HAVE_WORKING_O_NOATIME 1
> #define HAVE_WORKING_O_NOFOLLOW 1
> #define PROMOTED_MODE_T mode_t
> #define HAVE_DECL_STRMODE 0
> #define HAVE_MBSTATE_T 1
> #define _USE_STD_STAT 1
> #define HAVE_DECL_FSEEKO 1
> #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
> #define HAVE_DECL_FTELLO 1
> #define HAVE_SHUTDOWN 1
> #define HAVE_STRUCT_SOCKADDR_STORAGE 1
> #define HAVE_SA_FAMILY_T 1
> #define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
> #define HAVE_GETHOSTBYNAME 1
> #define HAVE_GETSERVBYNAME 1
> #define HAVE_DECL_INET_NTOP 1
> #define HAVE_IPV4 1
> #define HAVE_IPV6 1
> #define HAVE_DECL_GETCWD 1
> #define HAVE_DECL_GETDELIM 1
> #define HAVE_DECL_GETDTABLESIZE 1
> #define GETGROUPS_T gid_t
> #define HAVE_DECL_GETLINE 1
> #define HAVE_DECL_GETLOGIN_R 1
> #define HAVE_DECL_GETLOGIN 1
> #define HAVE_GETOPT_H 1
> #define HAVE_GETOPT_LONG_ONLY 1
> #define HAVE_DECL_FLOCKFILE 1
> #define HAVE_DECL_FUNLOCKFILE 1
> #define HAVE_PTHREAD_API 1
> #define SETLOCALE_NULL_ALL_MTSAFE 1
> #define SETLOCALE_NULL_ONE_MTSAFE 1
> #define HAVE_WINT_T 1
> #define HAVE_LONG_LONG_INT 1
> #define HAVE_UNSIGNED_LONG_LONG_INT 1
> #define HAVE_WCHAR_T 1
> #define HAVE_WEAK_SYMBOLS 1
> #define USE_POSIX_THREADS 1
> #define USE_POSIX_THREADS_FROM_LIBC 1
> #define MALLOC_0_IS_NONNULL 1
> #define HAVE_MAP_ANONYMOUS 1
> #define HAVE_DECL_MEMRCHR 1
> #define HAVE_MINMAX_IN_SYS_PARAM_H 1
> #define HAVE_DECL_ALARM 1
> #define HAVE_DECL_SETENV 1
> #define HAVE_SEARCH_H 1
> #define HAVE_TSEARCH 1
> #define HAVE_SIGSET_T 1
> #define HAVE_DECL_SNPRINTF 1
> #define HAVE__BOOL 1
> #define HAVE_DECL_FCLOSEALL 1
> #define __USE_MINGW_ANSI_STDIO 1
> #define HAVE_DECL_ECVT 1
> #define HAVE_DECL_FCVT 1
> #define HAVE_DECL_GCVT 1
> #define HAVE_DECL_STRDUP 1
> #define HAVE_DECL_STRNDUP 1
> #define HAVE_DECL_STRNLEN 1
> #define HAVE_DECL_EXECVPE 1
> #define HAVE_INTTYPES_H_WITH_UINTMAX 1
> #define HAVE_STDINT_H_WITH_UINTMAX 1
> #define HAVE_INTMAX_T 1
> #define DBL_EXPBIT0_WORD 1
> #define DBL_EXPBIT0_BIT 20
> #define HAVE_SNPRINTF 1
> #define HAVE_STRNLEN 1
> #define HAVE_WCSLEN 1
> #define HAVE_WCSNLEN 1
> #define HAVE_MBRTOWC 1
> #define HAVE_WCRTOMB 1
> #define HAVE_DECL__SNPRINTF 0
> #define HAVE_SNPRINTF_RETVAL_C99 1
> #define HAVE_SNPRINTF_TRUNCATION_C99 1
> #define HAVE_DECL_VSNPRINTF 1
> #define HAVE_DECL_WCSDUP 1
> #define HAVE_TOWLOWER 1
> #define HAVE_ALLOCA 1
> #define HAVE_DECL_PROGRAM_INVOCATION_NAME 1
> #define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 1
> #define HAVE_PROGRAM_INVOCATION_NAME 1
> #define HAVE_PROGRAM_INVOCATION_SHORT_NAME 1
> #define GNULIB_TEST_BTOWC 1
> #define HAVE___BUILTIN_EXPECT 1
> #define GNULIB_TEST_CALLOC_POSIX 1
> #define GNULIB_TEST_CHDIR 1
> #define HAVE_CLOCK_GETTIME 1
> #define HAVE_CLOCK_SETTIME 1
> #define GNULIB_TEST_CLOEXEC 1
> #define GNULIB_TEST_CLOSE 1
> #define HAVE_CLOSEDIR 1
> #define GNULIB_TEST_CLOSEDIR 1
> #define D_INO_IN_DIRENT 1
> #define HAVE_STRUCT_DIRENT_D_TYPE 1
> #define HAVE_DIRFD 1
> #define HAVE_DECL_DIRFD 1
> #define GNULIB_TEST_DIRFD 1
> #define GNULIB_TEST_DUP 1
> #define GNULIB_TEST_DUP2 1
> #define GNULIB_TEST_ENVIRON 1
> #define GNULIB_TEST_EXPLICIT_BZERO 1
> #define GNULIB_TEST_FCHDIR 1
> #define GNULIB_TEST_FCNTL 1
> #define GNULIB_FCNTL_SAFER 1
> #define GNULIB_FD_SAFER_FLAG 1
> #define HAVE_DECL_FDOPENDIR 1
> #define GNULIB_TEST_FDOPENDIR 1
> #define GNULIB_FDOPENDIR 1
> #define FLEXIBLE_ARRAY_MEMBER /**/
> #define GNULIB_TEST_FNMATCH 1
> #define GNULIB_TEST_FOPEN 1
> #define GNULIB_FOPEN_GNU 1
> #define GNULIB_FOPEN_SAFER 1
> #define HAVE_DECL_FORKPTY 1
> #define HAVE_FORKPTY 1
> #define GNULIB_TEST_FORKPTY 1
> #define HAVE_FREE_POSIX 1
> #define GNULIB_TEST_FREE_POSIX 1
> #define GNULIB_TEST_FSEEK 1
> #define GNULIB_TEST_FSEEKO 1
> #define GNULIB_TEST_FSTAT 1
> #define GNULIB_TEST_FSTATAT 1
> #define GNULIB_TEST_FTELL 1
> #define GNULIB_TEST_FTELLO 1
> #define HAVE_STRUCT_STATFS_F_TYPE 1
> #define HAVE___FSWORD_T 1
> #define fts_open rpl_fts_open
> #define fts_close rpl_fts_close
> #define fts_read rpl_fts_read
> #define fts_set rpl_fts_set
> #define fts_children rpl_fts_children
> #define fts_cross_check rpl_fts_cross_check
> #define HAVE_GETADDRINFO 1
> #define HAVE_DECL_GAI_STRERROR 1
> #define HAVE_DECL_GAI_STRERRORA 0
> #define HAVE_DECL_GETADDRINFO 1
> #define HAVE_DECL_FREEADDRINFO 1
> #define HAVE_DECL_GETNAMEINFO 1
> #define HAVE_STRUCT_ADDRINFO 1
> #define GNULIB_TEST_GETADDRINFO 1
> #define HAVE_GETPAGESIZE 1
> #define HAVE_MINIMALLY_WORKING_GETCWD 1
> #define GNULIB_GETCWD 1
> #define GNULIB_TEST_GETCWD 1
> #define GNULIB_TEST_GETCWD 1
> #define GNULIB_TEST_GETDELIM 1
> #define HAVE_GETDOMAINNAME 1
> #define HAVE_DECL_GETDOMAINNAME 1
> #define GNULIB_TEST_GETDOMAINNAME 1
> #define GNULIB_TEST_GETDTABLESIZE 1
> #define HAVE_GETGROUPS 1
> #define GNULIB_TEST_GETGROUPS 1
> #define HAVE_GETHOSTNAME 1
> #define GNULIB_TEST_GETHOSTNAME 1
> #define GNULIB_TEST_GETLINE 1
> #define GNULIB_TEST_GETLOGIN_R 1
> #define __GETOPT_PREFIX rpl_
> #define GNULIB_TEST_GETOPT_POSIX 1
> #define GNULIB_TEST_GETPASS 1
> #define GNULIB_TEST_GETPEERNAME 1
> #define HAVE_DECL_PROGRAM_INVOCATION_NAME 1
> #define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 1
> #define HAVE_DECL___ARGV 0
> #define GNULIB_TEST_GETRANDOM 1
> #define HAVE_DECL_GETUSERSHELL 1
> #define GNULIB_TEST_GETUSERSHELL 1
> #define GNULIB_TEST_GLOB 1
> #define HAVE_GETHOSTBYNAME 1
> #define HAVE_DECL_INET_NTOP 1
> #define HAVE_IOCTL 1
> #define GNULIB_TEST_IOCTL 1
> #define GNULIB_ISBLANK 1
> #define HAVE___INLINE 1
> #define GNULIB_TEST_LOCALECONV 1
> #define HAVE_PTHREAD_RWLOCK 1
> #define HAVE_PTHREAD_MUTEX_RECURSIVE 1
> #define GNULIB_LOCK 1
> #define HAVE_LOGIN_TTY 1
> #define GNULIB_TEST_LOGIN_TTY 1
> #define GNULIB_TEST_LSEEK 1
> #define GNULIB_TEST_LSTAT 1
> #define GNULIB_TEST_MALLOC_POSIX 1
> #define MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ 1
> #define GNULIB_TEST_MBRTOWC 1
> #define GNULIB_TEST_MBSINIT 1
> #define GNULIB_TEST_MBSRTOWCS 1
> #define HAVE_MBTOWC 1
> #define GNULIB_TEST_MBTOWC 1
> #define GNULIB_TEST_MEMCHR 1
> #define HAVE_MEMPCPY 1
> #define GNULIB_TEST_MEMPCPY 1
> #define HAVE_MEMRCHR 1
> #define GNULIB_TEST_MEMRCHR 1
> #define GNULIB_TEST_MKDIR 1
> #define GNULIB_TEST_MKSTEMP 1
> #define GNULIB_MSVC_NOTHROW 1
> #define FUNC_NL_LANGINFO_YESEXPR_WORKS 1
> #define NL_LANGINFO_MTSAFE 1
> #define GNULIB_TEST_NL_LANGINFO 1
> #define GNULIB_TEST_OPEN 1
> #define GNULIB_OPENAT 1
> #define GNULIB_TEST_OPENAT 1
> #define GNULIB_OPENAT_SAFER 1
> #define HAVE_OPENDIR 1
> #define GNULIB_TEST_OPENDIR 1
> #define HAVE_DECL_OPENPTY 1
> #define HAVE_OPENPTY 1
> #define GNULIB_TEST_OPENPTY 1
> #define GNULIB_TEST_PIPE 1
> #define HAVE_POLL 1
> #define GNULIB_TEST_POLL 1
> #define GNULIB_TEST_POSIX_OPENPT 1
> #define HAVE_DECL_PROGRAM_INVOCATION_NAME 1
> #define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 1
> #define HAVE_RAWMEMCHR 1
> #define GNULIB_TEST_RAWMEMCHR 1
> #define HAVE_READDIR 1
> #define GNULIB_TEST_READDIR 1
> #define HAVE_READLINE 1
> #define HAVE_READLINE_READLINE_H 1
> #define HAVE_READLINE_HISTORY_H 1
> #define HAVE_DECL_GETUTENT 1
> #define HAVE_STRUCT_UTMPX_UT_USER 1
> #define HAVE_STRUCT_UTMP_UT_USER 1
> #define HAVE_STRUCT_UTMPX_UT_NAME 1
> #define HAVE_STRUCT_UTMP_UT_NAME 1
> #define HAVE_STRUCT_UTMPX_UT_TYPE 1
> #define HAVE_STRUCT_UTMP_UT_TYPE 1
> #define HAVE_STRUCT_UTMPX_UT_PID 1
> #define HAVE_STRUCT_UTMP_UT_PID 1
> #define HAVE_STRUCT_UTMPX_UT_ID 1
> #define HAVE_STRUCT_UTMP_UT_ID 1
> #define HAVE_STRUCT_UTMPX_UT_EXIT 1
> #define HAVE_STRUCT_UTMP_UT_EXIT 1
> #define HAVE_STRUCT_UTMPX_UT_EXIT_E_EXIT 1
> #define HAVE_STRUCT_UTMP_UT_EXIT_E_EXIT 1
> #define HAVE_STRUCT_UTMPX_UT_EXIT_E_TERMINATION 1
> #define HAVE_STRUCT_UTMP_UT_EXIT_E_TERMINATION 1
> #define GNULIB_TEST_REALLOC_POSIX 1
> #define HAVE_REALLOCARRAY 1
> #define GNULIB_REALLOCARRAY 1
> #define GNULIB_TEST_REALLOCARRAY 1
> /* end confdefs.h.  */
> #include <regex.h>
> 
>             #include <locale.h>
>             #include <limits.h>
>             #include <string.h>
> 
>             #if defined M_CHECK_ACTION || HAVE_DECL_ALARM
>             # include <signal.h>
>             # include <unistd.h>
>             #endif
> 
>             #if HAVE_MALLOC_H
>             # include <malloc.h>
>             #endif
> 
>             #ifdef M_CHECK_ACTION
>             /* Exit with distinguishable exit code.  */
>             static void sigabrt_no_core (int sig) { raise (SIGTERM); }
>             #endif
> 
> int
> main ()
> {
> int result = 0;
>             static struct re_pattern_buffer regex;
>             unsigned char folded_chars[UCHAR_MAX + 1];
>             int i;
>             const char *s;
>             struct re_registers regs;
> 
>             /* Some builds of glibc go into an infinite loop on this
>                test.  Use alarm to force death, and mallopt to avoid
>                malloc recursion in diagnosing the corrupted heap. */
> #if HAVE_DECL_ALARM
>             signal (SIGALRM, SIG_DFL);
>             alarm (2);
> #endif
> #ifdef M_CHECK_ACTION
>             signal (SIGABRT, sigabrt_no_core);
>             mallopt (M_CHECK_ACTION, 2);
> #endif
> 
>             if (setlocale (LC_ALL, "en_US.UTF-8"))
>               {
>                 {
>                   /* 
> https://sourceware.org/ml/libc-hacker/2006-09/msg00008.html
>                      This test needs valgrind to catch the bug on Debian
>                      GNU/Linux 3.1 x86, but it might catch the bug better
>                      on other platforms and it shouldn't hurt to try the
>                      test here.  */
>                   static char const pat[] = "insert into";
>                   static char const data[] =
>                     "\xFF\0\x12\xA2\xAA\xC4\xB1,K\x12\xC4\xB1*\xACK";
>                   re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE
>                                  | RE_ICASE);
>                   memset (&regex, 0, sizeof regex);
>                   s = re_compile_pattern (pat, sizeof pat - 1, &regex);
>                   if (s)
>                     result |= 1;
>                   else
>                     {
>                       if (re_search (&regex, data, sizeof data - 1,
>                                      0, sizeof data - 1, &regs)
>                           != -1)
>                         result |= 1;
>                       regfree (&regex);
>                     }
>                 }
> 
>                 {
>                   /* This test is from glibc bug 15078.
>                      The test case is from Andreas Schwab in
>                      
> <https://sourceware.org/ml/libc-alpha/2013-01/msg00967.html>.
>                      */
>                   static char const pat[] = "[^x]x";
>                   static char const data[] =
>                     /* 
> <U1000><U103B><U103D><U1014><U103A><U102F><U1015><U103A> */
>                     "\xe1\x80\x80"
>                     "\xe1\x80\xbb"
>                     "\xe1\x80\xbd"
>                     "\xe1\x80\x94"
>                     "\xe1\x80\xba"
>                     "\xe1\x80\xaf"
>                     "\xe1\x80\x95"
>                     "\xe1\x80\xba"
>                     "x";
>                   re_set_syntax (0);
>                   memset (&regex, 0, sizeof regex);
>                   s = re_compile_pattern (pat, sizeof pat - 1, &regex);
>                   if (s)
>                     result |= 1;
>                   else
>                     {
>                       i = re_search (&regex, data, sizeof data - 1,
>                                      0, sizeof data - 1, 0);
>                       if (i != 0 && i != 21)
>                         result |= 1;
>                       regfree (&regex);
>                     }
>                 }
> 
>                 if (! setlocale (LC_ALL, "C"))
>                   return 1;
>               }
> 
>             /* This test is from glibc bug 3957, reported by Andrew Mackey.  
> */
>             re_set_syntax (RE_SYNTAX_EGREP | RE_HAT_LISTS_NOT_NEWLINE);
>             memset (&regex, 0, sizeof regex);
>             s = re_compile_pattern ("a[^x]b", 6, &regex);
>             if (s)
>               result |= 2;
>             else
>               {
>                 /* This should fail, but succeeds for glibc-2.5.  */
>                 if (re_search (&regex, "a\nb", 3, 0, 3, &regs) != -1)
>                   result |= 2;
>                 regfree (&regex);
>               }
> 
>             /* This regular expression is from Spencer ere test number 75
>                in grep-2.3.  */
>             re_set_syntax (RE_SYNTAX_POSIX_EGREP);
>             memset (&regex, 0, sizeof regex);
>             for (i = 0; i <= UCHAR_MAX; i++)
>               folded_chars[i] = i;
>             regex.translate = folded_chars;
>             s = re_compile_pattern ("a[[:]:]]b\n", 11, &regex);
>             /* This should fail with _Invalid character class name_ error.  */
>             if (!s)
>               {
>                 result |= 4;
>                 regfree (&regex);
>               }
> 
>             /* Ensure that [b-a] is diagnosed as invalid, when
>                using RE_NO_EMPTY_RANGES. */
>             re_set_syntax (RE_SYNTAX_POSIX_EGREP | RE_NO_EMPTY_RANGES);
>             memset (&regex, 0, sizeof regex);
>             s = re_compile_pattern ("a[b-a]", 6, &regex);
>             if (s == 0)
>               {
>                 result |= 8;
>                 regfree (&regex);
>               }
> 
>             /* This should succeed, but does not for glibc-2.1.3.  */
>             memset (&regex, 0, sizeof regex);
>             s = re_compile_pattern ("{1", 2, &regex);
>             if (s)
>               result |= 8;
>             else
>               regfree (&regex);
> 
>             /* The following example is derived from a problem report
>                against gawk from Jorge Stolfi <stolfi@ic.unicamp.br>.  */
>             memset (&regex, 0, sizeof regex);
>             s = re_compile_pattern ("[an\371]*n", 7, &regex);
>             if (s)
>               result |= 8;
>             else
>               {
>                 /* This should match, but does not for glibc-2.2.1.  */
>                 if (re_match (&regex, "an", 2, 0, &regs) != 2)
>                   result |= 8;
>                 else
>                   {
>                     free (regs.start);
>                     free (regs.end);
>                   }
>                 regfree (&regex);
>               }
> 
>             memset (&regex, 0, sizeof regex);
>             s = re_compile_pattern ("x", 1, &regex);
>             if (s)
>               result |= 8;
>             else
>               {
>                 /* glibc-2.2.93 does not work with a negative RANGE argument. 
>  */
>                 if (re_search (&regex, "wxy", 3, 2, -2, &regs) != 1)
>                   result |= 8;
>                 else
>                   {
>                     free (regs.start);
>                     free (regs.end);
>                   }
>                 regfree (&regex);
>               }
> 
>             /* The version of regex.c in older versions of gnulib
>                ignored RE_ICASE.  Detect that problem too.  */
>             re_set_syntax (RE_SYNTAX_EMACS | RE_ICASE);
>             memset (&regex, 0, sizeof regex);
>             s = re_compile_pattern ("x", 1, &regex);
>             if (s)
>               result |= 16;
>             else
>               {
>                 if (re_search (&regex, "WXY", 3, 0, 3, &regs) < 0)
>                   result |= 16;
>                 else
>                   {
>                     free (regs.start);
>                     free (regs.end);
>                   }
>                 regfree (&regex);
>               }
> 
>             /* Catch a bug reported by Vin Shelton in
>                https://lists.gnu.org/r/bug-coreutils/2007-06/msg00089.html
>                */
>             re_set_syntax (RE_SYNTAX_POSIX_BASIC
>                            & ~RE_CONTEXT_INVALID_DUP
>                            & ~RE_NO_EMPTY_RANGES);
>             memset (&regex, 0, sizeof regex);
>             s = re_compile_pattern ("[[:alnum:]_-]\\+$", 16, &regex);
>             if (s)
>               result |= 32;
>             else
>               regfree (&regex);
> 
>             /* REG_STARTEND was added to glibc on 2004-01-15.
>                Reject older versions.  */
>             if (! REG_STARTEND)
>               result |= 64;
> 
>             /* Matching with the compiled form of this regexp would provoke
>                an assertion failure prior to glibc-2.28:
>                  regexec.c:1375: pop_fail_stack: Assertion 'num >= 0' failed
>                With glibc-2.28, compilation fails and reports the invalid
>                back reference.  */
>             re_set_syntax (RE_SYNTAX_POSIX_EGREP);
>             memset (&regex, 0, sizeof regex);
>             s = re_compile_pattern ("0|()0|\\1|0", 10, &regex);
>             if (!s)
>               {
>                 memset (&regs, 0, sizeof regs);
>                 i = re_search (&regex, "x", 1, 0, 1, &regs);
>                 if (i != -1)
>                   result |= 64;
>                 if (0 <= i)
>                   {
>                     free (regs.start);
>                     free (regs.end);
>                   }
>                 regfree (&regex);
>               }
>             else
>               {
>                 if (strcmp (s, "Invalid back reference"))
>                   result |= 64;
>               }
> 
>             /* glibc bug 11053.  */
>             re_set_syntax (RE_SYNTAX_POSIX_BASIC);
>             memset (&regex, 0, sizeof regex);
>             static char const pat_sub2[] = "\\(a*\\)*a*\\1";
>             s = re_compile_pattern (pat_sub2, sizeof pat_sub2 - 1, &regex);
>             if (s)
>               result |= 64;
>             else
>               {
>                 memset (&regs, 0, sizeof regs);
>                 static char const data[] = "a";
>                 int datalen = sizeof data - 1;
>                 i = re_search (&regex, data, datalen, 0, datalen, &regs);
>                 if (i != 0)
>                   result |= 64;
>                 else if (regs.num_regs < 2)
>                   result |= 64;
>                 else if (! (regs.start[0] == 0 && regs.end[0] == 1))
>                   result |= 64;
>                 else if (! (regs.start[1] == 0 && regs.end[1] == 0))
>                   result |= 64;
>                 regfree (&regex);
>                 free (regs.start);
>                 free (regs.end);
>               }
> 
> #if 0
>             /* It would be nice to reject hosts whose regoff_t values are too
>                narrow (including glibc on hosts with 64-bit ptrdiff_t and
>                32-bit int), but we should wait until glibc implements this
>                feature.  Otherwise, support for equivalence classes and
>                multibyte collation symbols would always be broken except
>                when compiling --without-included-regex.   */
>             if (sizeof (regoff_t) < sizeof (ptrdiff_t)
>                 || sizeof (regoff_t) < sizeof (ssize_t))
>               result |= 64;
> #endif
> 
>             return result;
> 
>   ;
>   return 0;
> }




-- 
++  Michael Brunnbauer
++  netEstate GmbH
++  Geisenhausener Straße 11a
++  81379 München
++  Tel +49 89 32 19 77 80
++  Fax +49 89 32 19 77 89 
++  E-Mail brunni@netestate.de
++  https://www.netestate.de/
++
++  Sitz: München, HRB Nr.142452 (Handelsregister B München)
++  USt-IdNr. DE221033342
++  Geschäftsführer: Michael Brunnbauer, Franz Brunnbauer
++  Prokurist: Dipl. Kfm. (Univ.) Markus Hendel

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]