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
Perl regexp state gets clobbered (includes a fix) #8098
Comments
From geoff@gate.netThe following problem has been observed under versions of Perl after 5.8.4 The following regex was causing either an Out of Memory condition or a if ($a =~ m/^([A-Za-z]+)(.*)/) It was caused by the PL_regeol variable of regexec.c getting overwritten if (a) When av_store is called, the previous positional parameter is My solution is given in a patch at the very end of this email. Please I added the following call to sv_clear() in sv.c: save_re_context(); just prior to the call to the object's DESTROY method. This allows regular I agree with the comments above the save_re_context() function that this Thanks for getting my fix in to the Perl distribution. Sincerely, Geoff Mottram --------------Output of perl -V ------------ Summary of my perl5 (revision 5 version 8 subversion 7) configuration: Characteristics of this binary (from libperl): ------------Output of perbug -d ------------- Flags: Site configuration information for perl v5.8.7: Configured by minaret at Wed Sep 7 06:08:36 EDT 2005. Summary of my perl5 (revision 5 version 8 subversion 7) configuration: Locally applied patches: @INC for perl v5.8.7: Environment for perl v5.8.7: PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin/bin:/usr/local/java/jdk1.5.0_04/bin:/usr/local/java/jdk1.5.0_04/jre/bin:/minaret/m/bin:/minaret/m/util:/minaret/bin ----- gdb backtrace showing how PL_regeol gets clobbered by #0 Perl_re_intuit_start (prog=0x90e5070, sv=0x8fda2a0, strpos=0x9727d28 ---------------- Patch for sv.c to fix problem --------------- Inline Patch--- sv.c.orig 2005-05-27 06:38:11.000000000 -0400
+++ sv.c 2005-09-07 19:31:19.000000000 -0400
@@ -5102,6 +5102,8 @@
SV* tmpref = newRV(sv);
SvREADONLY_on(tmpref); /* DESTROY() could be naughty */
ENTER;
+ /* Next line added by Geoff Mottram 9/7/05. */
+ save_re_context();
PUSHSTACKi(PERLSI_DESTROY);
EXTEND(SP, 2);
PUSHMARK(SP);
--------------------------------------------------------------- |
From geoff@gate.netThe problem with regular expressions getting clobbered only occurs while Best, Geoff Mottram |
From @rgarciaOn 9/18/05, Geoff Mottram <geoff@gate.net> wrote:
That's probable. In this case, other Devel:: modules might be affected |
The RT System itself - Status changed from 'new' to 'open' |
From @rgarciaOn 9/8/05, via RT Geoff Mottram <perlbug-followup@perl.org> wrote:
Given that your bug happens inside the debugger, I wonder whether the ==== //depot/perl/pp_hot.c#415 - /opt/bleadperl/p4/perl/pp_hot.c ==== Inline Patch--- /home/rafael/tmp/tmp.14639.0 2005-10-09 18:59:52.901594208 +0200
+++ /opt/bleadperl/p4/perl/pp_hot.c 2005-10-09 18:57:32.849885304 +0200
@@ -2657,6 +2657,7 @@ PP(pp_entersub)
if (CvASSERTION(cv) && PL_DBassertion)
sv_setiv(PL_DBassertion, 1);
+ save_re_context();
cv = get_db_sub(&sv, cv);
if (!cv || (!CvXSUB(cv) && !CvSTART(cv)))
DIE(aTHX_ "No DB::sub routine defined");
However, I can't reproduce your problem, so I'm not sure if it fixes it. |
From @rgarciaOn 10/9/05, Rafael Garcia-Suarez <rgarciasuarez@gmail.com> wrote:
Meanwhile I applied this workaround : Change 25721 by rgs@marais on 2005/10/09 16:42:26 Don't use a regexp in DB::sub(). Affected files ... ... //depot/perl/lib/DB.pm#6 edit Differences ... ==== //depot/perl/lib/DB.pm#6 (text) ==== @@ -63,8 +63,7 @@ |
@rgs - Status changed from 'open' to 'stalled' |
From guest@guest.guest.xxxxxxxxI noticed this bug is marked as 'stalled', however I've recently run # Now SWASHGET is recasted into a C function S_swash_get (see utf8.c). code that I believe recreates this problem is attached. It looks like this bug can probably be closed for 5.8.8 but would be |
The RT System itself - Status changed from 'stalled' to 'open' |
From @smpetersOn Thu Jul 05 09:24:52 2007, guest wrote:
This does appear to be fixed. worf:perl-current steve$ ./perl -Ilib rt_37102.pl |
@smpeters - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#37102 (status was 'resolved')
Searchable as RT37102$
The text was updated successfully, but these errors were encountered: