Closed p5pRT closed 20 years ago
Hi. The following program leads to a core dump.
#!/usr/sbin/perl -w
undef($/);
%functions = ();
foreach $file (@ARGV) { (open(FILE\, $file)) || (die "Can't open $file for reading: $!; stopped");
my($input) = \
$^D = 14 + 512;
while ($input =~ m/^([_a-zA-Z]+[^\n\(]*) (\(.*\)(?!\s*\;)[^\{]*\{.*?\}(?=.*?(?:^[_a-zA-Z]+)|\Z))/mgx) { $^D = 0; my($what) = $1; my($found) = $1 . $2; my($output) = $file . ":\n\t" . $found; if (exists($functions{$what})) { $functions{$what} .= "\n" . $output; } else { $functions{$what} = $output; } } $^D = 0;
close(FILE); }
print join("\n\n"\, map {$functions{$_}} (sort (keys %functions))) . "\n";
The stack trace is as follows:
regmatch(\
The debug mode output was as follows:
(/server/people/staff/easmith/perl/prog/extract.funcs.pl:12) LEAVE scope 5 at mg.c:152
=> SV_YES PVMG(526)
(/server/people/staff/easmith/perl/prog/extract.funcs.pl:12) nextstate
=> SV_YES
(/server/people/staff/easmith/perl/prog/extract.funcs.pl:14) enterloop
(/server/people/staff/easmith/perl/prog/extract.funcs.pl:14) ENTER scope 5 at pp_ctl.c:1439
(/server/people/staff/easmith/perl/prog/extract.funcs.pl:14) ENTER scope 6 at pp_ctl.c:1441
Entering block 2\, type LOOP
=> SV_YES
(/server/people/staff/easmith/perl/prog/extract.funcs.pl:14) padsv
=> SV_YES PV("#include "phylip.h"
#include "drawgraphics.h"
/* Version 3.52c. Copyright (c) 1986-1993 by Joseph Felsenstein and
Christoph")
(/server/people/staff/easmith/perl/prog/extract.funcs.pl:14) match
Matching `^([_a-zA-Z]+[^\n\(]*)
(\(.*\)(?!\s*;)[^\{]*\{.*?\}(?=.*?(?...' against `#include "phylip.h"
#include "drawgraphics.h"
/* Version 3....' Setting an EVAL scope\, savestack=19 Segmentation fault (core dumped)
Thanks\,
-Allen
Hi. The following program leads to a core dump.
#!/usr/sbin/perl -w
undef($/);
%functions = ();
foreach $file (@ARGV) { (open(FILE\, $file)) || (die "Can't open $file for reading: $!; stopped");
my($input) = ;
$^D = 14 + 512;
while ($input =~ m/^([_a-zA-Z]+[^\n\(]*) (\(.*\)(?!\s*\;)[^\{]*\{.*?\}(?=.*?(?:^[_a-zA-Z]+)|\Z))/mgx) { $^D = 0; my($what) = $1; my($found) = $1 . $2; my($output) = $file . ":\n\t" . $found; if (exists($functions{$what})) { $functions{$what} .= "\n" . $output; } else { $functions{$what} = $output; } } $^D = 0;
close(FILE); }
print join("\n\n"\, map {$functions{$_}} (sort (keys %functions))) . "\n";
The stack trace is as follows:
regmatch() ["regexec.c":790\, 0x100c1110] regtry() ["regexec.c":734\, 0x100c0dd4] Perl_regexec_flags() ["regexec.c":332\, 0x100bf7f4] Perl_pp_match() ["pp_hot.c":922\, 0x1002b2b8] Perl_runops_debug() ["run.c":66\, 0x100be17c] perl_run() ["perl.c":1088\, 0x10084320] main() ["perlmain.c":45\, 0x10013728] __start() ["crt1text.s":166\, 0x10013648]
The debug mode output was as follows:
(/server/people/staff/easmith/perl/prog/extract.funcs.pl:12) LEAVE scope 5 at mg.c:152 => SV_YES PVMG(526) (/server/people/staff/easmith/perl/prog/extract.funcs.pl:12) nextstate => SV_YES (/server/people/staff/easmith/perl/prog/extract.funcs.pl:14) enterloop (/server/people/staff/easmith/perl/prog/extract.funcs.pl:14) ENTER scope 5 at pp_ctl.c:1439 (/server/people/staff/easmith/perl/prog/extract.funcs.pl:14) ENTER scope 6 at pp_ctl.c:1441 Entering block 2\, type LOOP => SV_YES (/server/people/staff/easmith/perl/prog/extract.funcs.pl:14) padsv => SV_YES PV("#include "phylip.h" #include "drawgraphics.h"
/* Version 3.52c. Copyright (c) 1986-1993 by Joseph Felsenstein and Christoph") (/server/people/staff/easmith/perl/prog/extract.funcs.pl:14) match Matching `^([_a-zA-Z]+[^\n\(]*) (\(.*\)(?!\s*;)[^\{]*\{.*?\}(?=.*?(?...' against `#include "phylip.h" #include "drawgraphics.h"
/* Version 3....' Setting an EVAL scope\, savestack=19 Segmentation fault (core dumped)
Thanks\,
-Allen
In \199911182312\.SAA08627@​feste\.rutgers\.edu\, Ed Allen Smith writes: :This is a bug report for perl from easmith@beatrice.rutgers.edu\, :generated with the help of perlbug 1.26 running under perl 5.00502.
The latest stable version of perl is 5.005_03 - please try your program under that version.
:Hi. The following program leads to a core dump. : :#!/usr/sbin/perl -w : :undef($/); : :%functions = (); : :foreach $file (@ARGV) { : (open(FILE\, $file)) || (die "Can't open $file for reading: $!; stopped"); [snip]
I was unable to reproduce your problem with a 5.005_02 perl here\, when I tried throwing some random C source files at it. However I have no idea what the program is trying to do or what style of data it expects\, and there was no output from the program when I tried running it.
If your problem persists under 5.005_03\, please a) reduce the test case so that both code and data are as small as possible and b) provide the necessary data as well as the code in your bug report.
Thanks\,
Hugo van der Sanden
At 10:32 +0100 1999-11-19\, Hugo wrote:
If your problem persists under 5.005_03\, please a) reduce the test case so that both code and data are as small as possible and b) provide the necessary data as well as the code in your bug report.
Sage advice. However\, the keys "complex regex"\, "data-dependent"\, and "core dump" index the phrase "stack overflow due to deep recursion in regex engine" for me. While your stack trace doesn't suggest that recursion's your problem\, you might try running the script against your data with an increased stack allocation to see if the problem goes away. Whatever the outcome\, please let us know.
-- Dominic Dunlop
Please unsubscribe
Migrated from rt.perl.org#1802 (status was 'resolved')
Searchable as RT1802$