A script I created seem causes a segmentation fault. Here is the problem regex:
(?:.*\n)*? ((?:\t\.1\.3\.6\.1\.4\.1\.9\.2\.2\.1\.1\.10\.\d*[ ]=[ ]\d*[ ]\(INTEGER +\)\n)+) ((?:\t\.1\.3\.6\.1\.4\.1\.9\.2\.2\.1\.1\.11\.\d*[ ]=[ ]-*\d*[ ]\(INTEG +ER\)\n)+) ((?:\t\.1\.3\.6\.1\.4\.1\.9\.2\.2\.1\.1\.12\.\d*[ ]=[ ]\d*[ ]\(INTEGER +\)\n)+) ((?:\t\.1\.3\.6\.1\.4\.1\.9\.2\.2\.1\.1\.13\.\d*[ ]=[ ]\d*[ ]\(INTEGER +\)\n)+) ((?:\t\.1\.3\.6\.1\.4\.1\.9\.2\.2\.1\.1\.14\.\d*[ ]=[ ]\d*[ ]\(INTEGER +\)\n)+) ((?:\t\.1\.3\.6\.1\.4\.1\.9\.2\.2\.1\.1\.15\.\d*[ ]=[ ]\d*[ ]\(INTEGER +\)\n)+) ((?:\t\.1\.3\.6\.1\.4\.1\.9\.2\.2\.1\.1\.16\.\d*[ ]=[ ]\d*[ ]\(INTEGER +\)\n)+) ((?:\t\.1\.3\.6\.1\.4\.1\.9\.2\.2\.1\.1\.17\.\d*[ ]=[ ]\d*[ ]\(INTEGER +\)\n)+) (?:.*\n)*? ((?:\t\.1\.3\.6\.1\.4\.1\.9\.2\.2\.1\.1\.21\.\d*[ ]=[ ]\d*[ ]\(INTEGER +\)\n)+) (?:.*\n)*? ((?:\t\.1\.3\.6\.1\.4\.1\.9\.2\.2\.1\.1\.25\.\d*[ ]=[ ]\d*[ ]\(INTEGER +\)\n)+) (?:.*\n)*? ((?:\t\.1\.3\.6\.1\.4\.1\.9\.2\.2\.1\.1\.28\.\d*[ ]=[ ][^\n]*[ ]\(OCTE +TSTR\)\n)+)
When I run this in a simple script that runs through all the files and applies it to the input it does not cause a segmentation fault, however, in the main script I created it does. The difference between the two is that I am getting the regex from a database and I am doing more regexes against more files. Changing this particular regex ieven a little changes where the segmentation fault occurs and  $gdb perl core shows it occurs in S_regmatch (prog=0x82fc628) at regexec.c:2312. When I remove this regex from the list of regexes I apply my script runs perfectly well. Did anyone run across this problem before? does anyone have any tips on how to proceed and what to look for? I tried this on numerous perl versions (5.8.3 5.8.4 5.8.5 5.8.6 5.8.7 5.8.8) all cause the same segfault. Thanks for the help.

In reply to regex causing segmentation fault (core dump) by Otogi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.