Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overloading Regexp and infinite recursion => SEGV #8438

Closed
p5pRT opened this issue May 6, 2006 · 4 comments
Closed

Overloading Regexp and infinite recursion => SEGV #8438

p5pRT opened this issue May 6, 2006 · 4 comments
Labels

Comments

@p5pRT
Copy link

@p5pRT p5pRT commented May 6, 2006

Migrated from rt.perl.org#39090 (status was 'rejected')

Searchable as RT39090$

@p5pRT
Copy link
Author

@p5pRT p5pRT commented May 6, 2006

From @andk

(Sorry if this comes as a duplicate. From my perspective perlbug does
not seem to have succeeded in delivering this bugreport.)

package Regexp;
use overload qq{""} => "stringify";
sub stringify { "$_[0]" }
my $qr = qr{foo};
print $qr;
__END__

The above program gives a SEGV. Sure, it is an endless recursion, but
still it should not segfault.

Tested with 5.8.7 and bleedperl@​28101. With the latter I saw this backtrace​:

#0 0xa7dcc22f in free () from /lib/tls/libc.so.6
#1 0xa7dcddfc in malloc () from /lib/tls/libc.so.6
#2 0x080a22ad in Perl_safesysmalloc ()
#3 0x080aef3a in Perl_av_extend ()
#4 0x080af38d in Perl_av_store ()
#5 0x08093565 in Perl_pad_push ()
#6 0x080b831a in Perl_pp_entersub ()
#7 0x08068c5c in Perl_amagic_call ()
#8 0x080bcbb2 in Perl_sv_2pv_flags ()
#9 0x080bd128 in Perl_sv_copypv ()
#10 0x080b1480 in Perl_pp_stringify ()
#11 0x080b1258 in Perl_runops_standard ()
#12 0x08068efd in Perl_amagic_call ()
#13 0x080bcbb2 in Perl_sv_2pv_flags ()
#14 0x080bd128 in Perl_sv_copypv ()
#15 0x080b1480 in Perl_pp_stringify ()
#16 0x080b1258 in Perl_runops_standard ()

etc. ad libitum

#87261 0x080b1258 in Perl_runops_standard ()
#87262 0x08068efd in Perl_amagic_call ()
#87263 0x080bcbb2 in Perl_sv_2pv_flags ()
#87264 0x080f4681 in Perl_do_print ()
#87265 0x080b2a51 in Perl_pp_print ()
#87266 0x080b1258 in Perl_runops_standard ()
#87267 0x08061664 in S_run_body ()
#87268 0x080614be in perl_run ()
#87269 0x0805e6bd in main ()

--
andreas

@p5pRT
Copy link
Author

@p5pRT p5pRT commented May 6, 2006

From @iabyn

On Fri, May 05, 2006 at 11​:20​:20PM -0700, Andreas Koenig wrote​:

The above program gives a SEGV. Sure, it is an endless recursion, but
still it should not segfault.

But that's what C programs do on endless recursion​:

$ cat c.c
int main() { main(); }

$ gcc -o c c.c
$ ./c
Segmentation fault
$

--
Technology is dominated by two types of people​: those who understand what
they do not manage, and those who manage what they do not understand.

@p5pRT
Copy link
Author

@p5pRT p5pRT commented May 6, 2006

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

@p5pRT p5pRT commented May 16, 2008

p5p@spam.wizbit.be - Status changed from 'open' to 'rejected'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant