develooper Front page | perl.perl5.porters | Postings from May 2004

Re: [perl #28986] perl -e "open m" crashes Perl with "Out of memory!" message

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
May 3, 2004 13:49
Subject:
Re: [perl #28986] perl -e "open m" crashes Perl with "Out of memory!" message
Message ID:
20040503205427.GH1895@iabyn.com
This is caused by the C<case KEY_open:> code in toke.c, which is scanning
forward to the token following the first arg of open, to see if a
'Possible prcedence' warning needs to be issued. This scanning forward can
follow onto the next line, in which case the PL_linestr buffer is
overwritten with the new line, and nastiness ensues. The patch below,
applied to bleedperl, stops it skipping onto the next line.

I'm not sure where to add a test for this: it needs a fresh perl (eval
won't do), but there isn't a t/op/open.t, and t/base.lex.t doesn't
look like to sort of place to include test.pl

Dave.

-- 
"Do not dabble in paradox, Edward, it puts you in danger of fortuitous
wit." -- Lady Croom - Arcadia


Change 22776 by davem@davem-percy on 2004/05/03 20:26:22

	[perl #28986] perl -e "open m" crashes Perl

Affected files ...

... //depot/perl/toke.c#498 edit

Differences ...

==== //depot/perl/toke.c#498 (text) ====

@@ -4681,8 +4681,8 @@
 	    if (isIDFIRST_lazy_if(s,UTF)) {
 		char *t;
 		for (d = s; isALNUM_lazy_if(d,UTF); d++) ;
-		t = skipspace(d);
-		if (strchr("|&*+-=!?:.", *t) && ckWARN_d(WARN_PRECEDENCE)
+		for (t=d; *t && isSPACE(*t); t++) ;
+		if ( *t && strchr("|&*+-=!?:.", *t) && ckWARN_d(WARN_PRECEDENCE)
 		    /* [perl #16184] */
 		    && !(t[0] == '=' && t[1] == '>')
 		) {

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About