re_search_2 bug with NULL reference

Alexander V. Lukyanov lav@yars.free.net
Sun Nov 3 23:33:00 GMT 2002


On Sat, Nov 02, 2002 at 04:52:45PM -0800, Roland McGrath wrote:
> Please isolate what the exact re_* calls are and the regex and match text
> involved, and produce a simple test program that just makes those calls and
> exhibits the crash.

Here is a short test program.

#include <string.h>
#include <regex.h>

int main()
{
        char *rexp="/\\*([^*]|\\*[^/])*\\*/";
        char *buf;
        struct re_pattern_buffer rexp_c;
        struct re_registers regs;
        int bs;

        memset(&rexp_c,0,sizeof(rexp_c));
        memset(&regs,0,sizeof(regs));

        buf="/*a\nb\nc*/\n";
        bs=strlen(buf);

        re_syntax_options=RE_NO_BK_VBAR|RE_NO_BK_PARENS;
        re_compile_pattern(rexp,strlen(rexp),&rexp_c);
        re_search_2(&rexp_c,buf,bs,0,0,0,bs,&regs,bs);

        return 0;
}

-- 
   Alexander.



More information about the Libc-alpha mailing list