mardi 10 septembre 2019

segmentation fault in regcomp() in suse linux

Getting crash in regcomp() on suse linux, Following is the backtrace,

    0x00007fb4bd90c0e0 in raise () from /lib64/libc.so.6
    (gdb) bt
    #0  0x00007fb4bd90c0e0 in raise () from /lib64/libc.so.6
    #1  0x00007fb4bd90d6c1 in abort () from /lib64/libc.so.6
    #2  0x00007fb4bd94f427 in __libc_message () from /lib64/libc.so.6
    #3  0x00007fb4bd955c43 in malloc_printerr () from /lib64/libc.so.6
    #4  0x00007fb4bd9595b1 in _int_malloc () from /lib64/libc.so.6
    #5  0x00007fb4bd95b61a in calloc () from /lib64/libc.so.6
    #6  0x00007fb4bd9aca65 in parse_expression () from /lib64/libc.so.6
    #7  0x00007fb4bd9ae087 in parse_branch () from /lib64/libc.so.6
    #8  0x00007fb4bd9ae1bc in parse_reg_exp () from /lib64/libc.so.6
    #9  0x00007fb4bd9ae797 in re_compile_internal () from /lib64/libc.so.6
    #10 0x00007fb4bd9b44e9 in regcomp () from /lib64/libc.so.6

Tried changing the const and non-const variables.

    should not crash

int main()  
{
    regex_t myRegEx;
    string str = "\\[[0-9]+\\][0-9]+\\[/[0-9]+\\]";

    const int retval = regcomp(&myRegEx, str.c_str(), REG_EXTENDED);

    return 0;
}

no crash

Aucun commentaire:

Enregistrer un commentaire