[pcre-dev] [Bug 969] New: compile_branch seg fault

Page principale
Supprimer ce message
Auteur: Matt Portas
Date:  
À: pcre-dev
Nouveaux-sujets: [pcre-dev] [Bug 969] compile_branch seg fault
Sujet: [pcre-dev] [Bug 969] New: compile_branch seg fault
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=969
           Summary: compile_branch seg fault
           Product: PCRE
           Version: 8.01
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Code
        AssignedTo: ph10@???
        ReportedBy: matt.r.portas@???
                CC: pcre-dev@???



A seg fault occurs in compile_branch when a string starting with "\0277\0377"
is passed to pcre_compile2 with compile options PCRE_CASELESS |
PCRE_NO_UTF8_CHECK | PCRE_UTF8.


#include "pcre.h"

int main ()
{
    const char needle[] = {0x5B, 0xFF};
    const char *errmsg;
    int erroffset, errcode, compile_options;


    compile_options = PCRE_CASELESS | PCRE_NO_UTF8_CHECK | PCRE_UTF8;
    (void)pcre_compile2 (needle, compile_options, &errcode,
                         &errmsg, &erroffset, NULL);
    return 0;
}


backtrace

#0  0x0000000000405d96 in compile_branch (optionsptr=0x7fffffffd46c,
    codeptr=0x7fffffffd4a0, ptrptr=0x7fffffffd4a8,
    errorcodeptr=0x7fffffffe630, firstbyteptr=0x7fffffffd48c,
    reqbyteptr=0x7fffffffd488, bcptr=0x7fffffffd470, cd=0x7fffffffe590,
    lengthptr=0x7fffffffd484) at pcre_compile.c:3576
#1  0x0000000000409cb5 in compile_regex (options=10241, oldims=1,
    codeptr=0x7fffffffe628, ptrptr=0x7fffffffe620,
    errorcodeptr=0x7fffffffe630, lookbehind=0, reset_bracount=0, skipbytes=0,
    firstbyteptr=0x7fffffffe638, reqbyteptr=0x7fffffffe634, bcptr=0x0,
    cd=0x7fffffffe590, lengthptr=0x7fffffffe63c) at pcre_compile.c:5877
#2  0x000000000040ae52 in pcre_compile2 (pattern=0x7fffffffe6e0 "[\377",
    options=10241, errorcodeptr=0x7fffffffe6d0, errorptr=0x7fffffffe6d8,
    erroroffset=0x7fffffffe6d4, tables=0x41ac40 "") at pcre_compile.c:6591
#3  0x0000000000400c46 in main () at pcre-regex-bug.c:14



Program received signal SIGSEGV, Segmentation fault.
0x0000000000405d96 in compile_branch (optionsptr=0x7fffffffd46c,
    codeptr=0x7fffffffd4a0, ptrptr=0x7fffffffd4a8,
    errorcodeptr=0x7fffffffe630, firstbyteptr=0x7fffffffd48c,
    reqbyteptr=0x7fffffffd488, bcptr=0x7fffffffd470, cd=0x7fffffffe590,
    lengthptr=0x7fffffffd484) at pcre_compile.c:3576
3576              if ((othercase = UCD_OTHERCASE(c)) != c)



--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email