Closed p5pRT closed 19 years ago
Hi\,
It seems like I just stumbled over a funny bug.
perl -e 'not() || 1' perl -e 'die unless not()' ...
Like in the two examples above\, the evaluation of not() produces a segmentation fault or a freeze of the interpreter. This problem occurred on several platforms ( x86/Linux\, sparc64/Solaris ) and perl versions ( 5.6.1\, 5.8.4\, 5.8.6 ).
Regards\, Robin Stocker
On Thu\, 10 Feb 2005\, robin.stocker@nibor.org (via RT) wrote:
It seems like I just stumbled over a funny bug.
perl -e 'not() || 1' perl -e 'die unless not()' ...
Confirmed on x86/win32 version 5.8.4.
What's also interesting is that\, in my case:
perl -e 'not() || \
crashes\, while
perl -e '1; not() || \
hangs and
perl -m\
hangs\, yet
perl -e -m\
doesn't crash or hang. A very interesting bug :)
Alexey
The RT System itself - Status changed from 'new' to 'open'
On Thu\, Feb 10\, 2005 at 05:00:02PM +0000\, Alexey Toptygin wrote:
perl -m\
-e 'not() || \ ' hangs\, yet
perl -e -m\
'not() || \ ' doesn't crash or hang. A very interesting bug :)
That last one's not that interesting.
% perl -MO=Deparse -e -mCGI 'not() || 1' -'mCGI'; -e syntax OK %
:)
Ronald
robin.stocker@nibor.org (via RT) wrote:
perl -e 'not() || 1' perl -e 'die unless not()' ...
Like in the two examples above\, the evaluation of not() produces a segmentation fault or a freeze of the interpreter.
It occurs in bleadperl as well; but that's not the evaluation of not() that segfault\, since the bug appears with -c as well.
On Thu\, Feb 10\, 2005 at 12:29:51PM -0500\, Ronald J Kimball wrote:
On Thu\, Feb 10\, 2005 at 05:00:02PM +0000\, Alexey Toptygin wrote:
perl -m\
-e 'not() || \ ' hangs\, yet
perl -e -m\
'not() || \ ' doesn't crash or hang. A very interesting bug :)
That last one's not that interesting.
% perl -MO=Deparse -e -mCGI 'not() || 1' -'mCGI'; -e syntax OK %
Here's the backtrace from blead...
(gdb) bt #0 0x1c05f94d in S_new_logop (my_perl=0x3c030000\, type=159\, flags=0\, firstp=0xcfbf2d34\, otherp=0xcfbf2d38) at op.c:3484 #1 0x1c05f846 in Perl_newLOGOP (my_perl=0x3c030000\, type=160\, flags=0\, first=0x0\, other=0x3c03c940) at op.c:3459 #2 0x1c053f22 in Perl_yyparse (my_perl=0x3c030000) at perly.y:515 #3 0x1c01ced5 in S_parse_body (my_perl=0x3c030000\, env=0x0\, xsinit=0x1c016e5c \<xs_init>) at perl.c:1684 #4 0x1c01bbc7 in perl_parse (my_perl=0x3c030000\, xsinit=0x1c016e5c \<xs_init>\, argc=3\, argv=0xcfbf2f40\, env=0x0) at perl.c:1194 #5 0x1c016dc8 in main (argc=3\, argv=0xcfbf2f40\, env=0xcfbf2f50) at perlmain.c:96
Steve Peters steve@fisharerojo.org
The segfault can be reproduced with all versions of Perl since 5.6.0.
It has been fixed by the following change:
Change 23960 by mhx@mhx-r2d2 on 2005/02/10 20:50:31
[perl #34101] not() || 1 produces segmentation fault
Fixed by making not() behave like not(0). This is also the
way not() behaved before it started segfaulting in 5.6.0.
@mhx - Status changed from 'open' to 'resolved'
On Thu\, Feb 10\, 2005 at 06:15:17PM +0100\, Rafael Garcia-Suarez wrote:
robin.stocker@nibor.org (via RT) wrote:
perl -e 'not() || 1' perl -e 'die unless not()' ...
Like in the two examples above\, the evaluation of not() produces a segmentation fault or a freeze of the interpreter.
It occurs in bleadperl as well; but that's not the evaluation of not() that segfault\, since the bug appears with -c as well.
Its the fact that the OP struct containing the NOT operator doesn't have a child\, and various parts of the the core assume that it always has a child. The proper fix is to stop the lexer/parser generating such a bad op in the first place\, but it's (as always) too late at night for my poor brain to work out how to do such a thing.
-- Nothing ventured\, nothing lost.
On 2005-02-11\, at 00:29:58 +0000\, Dave Mitchell wrote:
On Thu\, Feb 10\, 2005 at 06:15:17PM +0100\, Rafael Garcia-Suarez wrote:
robin.stocker@nibor.org (via RT) wrote:
perl -e 'not() || 1' perl -e 'die unless not()' ...
Like in the two examples above\, the evaluation of not() produces a segmentation fault or a freeze of the interpreter.
It occurs in bleadperl as well; but that's not the evaluation of not() that segfault\, since the bug appears with -c as well.
Its the fact that the OP struct containing the NOT operator doesn't have a child\, and various parts of the the core assume that it always has a child. The proper fix is to stop the lexer/parser generating such a bad op in the first place\, but it's (as always) too late at night for my poor brain to work out how to do such a thing.
It has already been fixed by change #23960\, but somehow my RT response didn't show up on the list (yet).
Marcus
-- To iterate is human\, to recurse\, divine. -- Robert Heller
Migrated from rt.perl.org#34101 (status was 'resolved')
Searchable as RT34101$