You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Gurusamy Sarathy <gs...@ActiveState.com> on 2000/10/08 06:32:25 UTC

Re: CGI::Carp, use X, die in X.pm causes 0xc0000005 (APR#330)

On Fri, 21 Apr 2000 18:12:45 PDT, kojun@apro.co.jp wrote:
>Full_Name: UENO Kojun
>Version: ActivePerl 613
>OS: Windows NT 4.0 SP 6
>Submission from: (NULL) (210.141.46.3)
>
>
>Following scripts cause the application error "c0000005 at address 78002f3e
>(strlen)". 
>
>% perl x.pl
>
>-------x.pl-------
>#! perl
>use CGI::Carp;
>use lib '.';
>use X;
>
>-------X.pm-------
>package X;
>die;
>1;

FYI, I just checked in the following fix for this problem.  I'm afraid
it is somewhat in the nature of a hack.  A proper fix would entail
eliminating save_re_context() and making the regular expression engine
reentrancy-safe, but I chickened out.


Sarathy
gsar@ActiveState.com
-----------------------------------8<-----------------------------------
Change 7165 by gsar@onru on 2000/10/08 04:15:29

	save_re_context() could reset PL_curcop to freed memory, causing core
	dumps in code such as C<use CGI::Carp; use something_that_calls_die;>

Affected files ...

... //depot/perl/pp_ctl.c#227 edit

Differences ...

==== //depot/perl/pp_ctl.c#227 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c.~1~	Sat Oct  7 21:14:39 2000
+++ perl/pp_ctl.c	Sat Oct  7 21:14:39 2000
@@ -1417,6 +1417,12 @@
 
 	    LEAVE;
 
+	    /* LEAVE could clobber PL_curcop (see save_re_context())
+	     * XXX it might be better to find a way to avoid messing with
+	     * PL_curcop in save_re_context() instead, but this is a more
+	     * minimal fix --GSAR */
+	    PL_curcop = cx->blk_oldcop;
+
 	    if (optype == OP_REQUIRE) {
 		char* msg = SvPVx(ERRSV, n_a);
 		DIE(aTHX_ "%sCompilation failed in require",
End of Patch.