1

I am trying to run a script that defines a few (complex) regular expressions: https://github.com/wo/opp-tools/blob/master/rules/Keywords.pm. Whenever I include this module, Perl crashes with the message "panic: reg_node overrun trying to emit 51 at rules/Keywords.pm line 60". This is with Perl v5.14.2 on Ubuntu 12.04. Any ideas what could be the cause of this would be appreciated.

Update: Here is a snippet that causes the problem.

use strict;
use warnings;
use utf8;

my $re_address_word = qr/\b(?:
universit|center|centre|institute?|sciences?|college|research|
avenue|street|philosophy|professor|address|department|
umass
)\b/ix;

our $re_publication_word = qr/\b(?:
forthcoming|editors?|edited|publish\w*|press|volume
to\sappear\sin|draft|editor\w*|reprints?|excerpt|
circulation|cite
)\b/ix;

my $re_notitle = qr/
$re_address_word |
$re_publication_word |
\b(?:thanks?|
   @|
   [12]\d{3}|
   abstract
)/ix;

our $re_title = qr/^
(?!.*$re_notitle?.*)
\p{IsAlpha}    
/x;
  • Could you post the regex causing the issue? Just in case the line number in github is different from the one you have. – Jerry Oct 01 '13 at 04:36
  • I included your module in a script without errors. Could you please share with us some more info? – psxls Oct 01 '13 at 07:58
  • Please include a small example script that demonstrates the problem. Don't link to something external that might go stale. :) – brian d foy Oct 01 '13 at 14:10
  • OK. I've added an example script. Here I get "panic: reg_node overrun trying to emit 46 at test.pl line 26." Line 26 is "our $re_title = qr/^". – diagonallemma Oct 01 '13 at 22:19
  • The code snippet you added, doesn't include the Keywords.pm as said. In addition it compiles and run without any errors! – psxls Oct 01 '13 at 23:53
  • Well, yes, I've narrowed down the problem to this part of Keywords.pm. It definitely doesn't compile for me, on a newly set up Ubuntu 12.04 LTS server with the most recent updates installed. Is there some sort of flag to restrict the memory perl allocates to regular expressions? "reg_node overrun" suggests some kind of buffer overrun. – diagonallemma Oct 02 '13 at 01:21

1 Answers1

0

I ran into the same problem today when compiling regular expressions consisting of multiple expression. The example below illustrates the code that generated the problem:

    my $cities = qr/(Foo1|Foo2|FooBarss)/;
    ## Solution change ss -> s[s]
    ## my $cities = qr/(Foo1|Foo2|FooBars[s])/;
    my $street = qr/(foo|bar|baz)/;

    $text =~ /$street \s+ $cities/;

The solution was to replace literal ss with s[s], it seems pretty random and I cannot dig up the reference to support it but it works for me.