I was revisiting Negating Regexes: Tips, Tools, And Tricks Of The Trade and caused perl to segfault with one of the patterns I tried. I reduced the pattern to he simplest form that still causes a problem.
Tested with:
This is perl, v5.8.7 built for i486-linux-gnu-thread-multi
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES
PERL_IMPLICIT_CONTEXT
This works:
"1" =~ qr[(??{/^1/})]
This segfaults
"<" =~ qr[(??{/^</})]
Segfault re=debug output:
Freeing REx: `","'
Compiling REx `(??{/^</})'
size 4 Got 36 bytes for offset annotations.
Compiling REx `^<'
size 4 Got 36 bytes for offset annotations.
first at 2
1: BOL(2)
2: EXACT <<>(4)
4: END(0)
anchored `<' at 0 (checking anchored) anchored(BOL) minlen 1
Offsets: [4]
1[1] 2[1] 0[0] 3[0]
first at 1
1: LOGICAL[2](2)
2: EVAL(4)
4: END(0)
minlen 0 with eval
Offsets: [4]
10[0] 10[0] 0[0] 11[0]
Matching REx `(??{/^</})' against `<'
Setting an EVAL scope, savestack=15
0 <> <<> | 1: LOGICAL[2]
0 <> <<> | 2: EVAL
re_eval 0x8153fe8
Guessing start of match, REx `^<' against `<'...
Guessed: match at offset 0
Matching REx `^<' against `<'
Setting an EVAL scope, savestack=15
0 <> <<> | 1: BOL
0 <> <<> | 2: EXACT <<>
1 <<> <> | 4: END
Match successful!
Compiling REx `1'
size 3 Got 28 bytes for offset annotations.
first at 1
1: EXACT <1>(3)
3: END(0)
anchored `1' at 0 (checking anchored isall) minlen 1
Offsets: [3]
1[1] 0[0] 2[0]
Entering embedded `1'
Setting an EVAL scope, savestack=21
0 <> <<> | 1: EXACT <1>
failed...
Freeing REx: `"1"'
failed...
Setting an EVAL scope, savestack=24
1 <<> <> |50339: LOGICAL[2]
1 <<> <> |50340: EVAL
Is this fixed in later perls?
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|