[comp.lang.perl] Bug fix

worley@compass.com (Dale Worley) (12/13/90)

Problem:  Unterminated format in 'eval' causes Perl to crash.

To reproduce:  Run the program:
		eval "format STDOUT = \n";

Analysis:  The loop at line 2344 in load_format in toke.c assumes that
if the input buffer is exhausted it can read from the file 'rsfp'.
This is not correct if the input is from an 'eval'.

Fix:  Replace line 2344 with:
    while (s < bufend || (rsfp && (s = str_gets(linestr,rsfp, 0)) != Nullch)) {
This will cause the 'while' loop to terminate correctly and report a
"Format not terminated" error.

(This fix might not be entirely correct, since the relationship
between 'in_eval' and 'rsfp' is not entirely clear to me.)

Dale

Dale Worley		Compass, Inc.			worley@compass.com
--
The only constant through history is the beaurocratic mentality.