bug-glibc
[Top][All Lists]
Advanced

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

crash in regex using glibc 2.2.93 on RedHat 8.0


From: Jskud
Subject: crash in regex using glibc 2.2.93 on RedHat 8.0
Date: Tue, 25 Mar 2003 08:51:16 -0800

The follow program using regex crashes when run against glibc
2.2.93, as distributed with RedHat 8.0:

    Program received signal SIGSEGV, Segmentation fault.
    0x420c398d in proceed_next_node () from /lib/i686/libc.so.6
    (gdb) where
    #0  0x420c398d in proceed_next_node () from /lib/i686/libc.so.6
    #1  0x420bdcaf in set_regs () from /lib/i686/libc.so.6
    #2  0x420bd54f in re_search_internal () from /lib/i686/libc.so.6
    #3  0x420c2df5 in regexec () from /lib/i686/libc.so.6
    #4  0x0804843d in main () at demo_crash.c:44
    #5  0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6

It does not crash (and works as expected) when run against glibc-2.1.3,
as distributed with RedHat 6.2:

        gcc  -g -o demo_crash demo_crash.c
        ./demo_crash

                regexec result = 0
                regex worked OK

FYI.  /Jskud

================================================================

#include <sys/types.h>
#include <regex.h>

#include <assert.h>
#include <stdio.h>

static char *body = "[TheFirstLine]
<!--[if gte mso 10]>
<style>
 /* Style Definitions */=20
 table.MsoNormalTable
        {mso-style-name:QTable NormalQ;
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-parent:QQ;
        mso-padding-alt:0in 5.4pt 0in 5.4pt;
        mso-para-margin:0in;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:QTimes New RomanQ;}
</style>
<![endif]-->
[TheLastLine]" ;

int
main()
{
    int result ;

    const char* regex = "<!--([^-]|-[^-]|--[^>])*-->" ;
    regex_t preg;
    regmatch_t matches[256] ;

#if 0
    printf("body = <<%s>>\n", body) ;
#endif

    result = regcomp(&preg, regex, REG_EXTENDED) ;
    assert(result == REG_NOERROR) ;

    result = regexec(&preg, body, 256, matches, 0) ;
    printf("regexec result = %d\n", result) ;
    assert(result == REG_NOERROR) ;

    printf("regex worked OK\n") ;

    return 0 ;
}

================================================================




reply via email to

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