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
Dave Mitchell
May 3, 2004 13:49
Re: [perl #28986] perl -e "open m" crashes Perl with "Out of memory!" message
Message ID:
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


"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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About