develooper Front page | perl.perl5.porters | Postings from December 2013

[perl #72406] Segmentation fault v5.10.1

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
December 14, 2013 21:47
Subject:
[perl #72406] Segmentation fault v5.10.1
Message ID:
rt-4.0.18-27372-1387057629-986.72406-15-0@perl.org
On Tue Feb 02 00:36:23 2010, nicholas wrote:
> On Thu, Jan 28, 2010 at 02:45:49AM -0800, Michael G Schwern wrote:
> > abc poc (via RT) wrote:
> > > # BUG?
> > > perl -le 'do{print("foobar");}until(1)}'
> > > Segmentation fault
> > >
> > > My Englisch is very bad and i don't know how i can explain this
> > > bug.
> > >  I think you see what i mean. Why i don't have an error on until
> > > with one
> > > curly bracket to much?
> >
> > 5.8.9:  syntax error
> > 5.10.0: segfault
> > 5.10.1: segfault
> > 5.11.3: syntax error
> > 5.11.4: syntax error
> >
> > Looks like its already been handled in 5.11.
> 
> I think that it's just hidden. There's still a bug here, and I'm
> guessing
> that currently the read of uninialised memory usually isn't finding
> anything
> that provokes a SEGV:
> 
> $ valgrind ./perl -le 'do{print("foobar");}until(1)}'
> ==10807== Memcheck, a memory error detector.
> ==10807== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et
> al.
> ==10807== Using LibVEX rev 1854, a library for dynamic binary
> translation.
> ==10807== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
> ==10807== Using valgrind-3.3.1-Debian, a dynamic binary
> instrumentation framework.
> ==10807== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et
> al.
> ==10807== For more details, rerun with: -v
>  ==10807==
> ==10807== Invalid read of size 8
> ==10807==    at 0x4347C2: Perl_newLOOPOP (op.c:4905)
> ==10807==    by 0x4BF4C6: Perl_yyparse (perly.y:267)
> ==10807==    by 0x451800: S_parse_body (perl.c:2160)
> ==10807==    by 0x44FA4E: perl_parse (perl.c:1605)
> ==10807==    by 0x421F10: main (perlmain.c:115)
> ==10807==  Address 0x5e9fe40 is 0 bytes after a block of size 48
> alloc'd
> ==10807==    at 0x4C203E4: calloc (vg_replace_malloc.c:397)
> ==10807==    by 0x42EB5F: Perl_newSVOP (op.c:3770)
> ==10807==    by 0x4B9871: Perl_scan_num (toke.c:13049)
> ==10807==    by 0x4946E7: Perl_yylex (toke.c:5699)
> ==10807==    by 0x4BECDE: Perl_yyparse (perly.c:414)
> ==10807==    by 0x451800: S_parse_body (perl.c:2160)
> ==10807==    by 0x44FA4E: perl_parse (perl.c:1605)
> ==10807==    by 0x421F10: main (perlmain.c:115)
> Unmatched right curly bracket at -e line 1, at end of line
> syntax error at -e line 1, near ")}"
> Execution of -e aborted due to compilation errors.
> ==10807== Warning: bad signal number 0 in sigaction()
>  ==10807==
> ==10807== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 8 from
> 1)
> ==10807== malloc/free: in use at exit: 0 bytes in 0 blocks.
> ==10807== malloc/free: 664 allocs, 664 frees, 176,297 bytes allocated.
> ==10807== For counts of detected errors, rerun with: -v
> ==10807== All heap blocks were freed -- no leaks are possible.
> 
> Nicholas Clark

Nicholas,

In 2010 you felt this RT should remain open, even though the OP's problem appeared to have cleared up with Perl 5.11.

Today I configured and built Perl as follows on Dromedary:

#####
sh ./Configure -Dusedevel -des -Dusethreads
#####

(I felt that was sufficiently close to the OP's more numerous configuration options.)

As expected, the OP's code sample now gives an error, rather than a segfault:

#####
$ ./perl -Ilib -le 'do{print("foobar");}until(1)}'
Unmatched right curly bracket at -e line 1, at end of line
syntax error at -e line 1, near ")}"
Execution of -e aborted due to compilation errors.
#####

I then re-ran that command under valgrind:

#####
$ valgrind ./perl -Ilib -le 'do{print("foobar");}until(1)}'
==22991== Memcheck, a memory error detector
==22991== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==22991== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==22991== Command: ./perl -Ilib -le do{print("foobar");}until(1)}
==22991== 
Unmatched right curly bracket at -e line 1, at end of line
syntax error at -e line 1, near ")}"
Execution of -e aborted due to compilation errors.
==22991== 
==22991== HEAP SUMMARY:
==22991==     in use at exit: 142,680 bytes in 570 blocks
==22991==   total heap usage: 751 allocs, 181 frees, 177,028 bytes allocated
==22991== 
==22991== LEAK SUMMARY:
==22991==    definitely lost: 7,609 bytes in 15 blocks
==22991==    indirectly lost: 135,071 bytes in 555 blocks
==22991==      possibly lost: 0 bytes in 0 blocks
==22991==    still reachable: 0 bytes in 0 blocks
==22991==         suppressed: 0 bytes in 0 blocks
==22991== Rerun with --leak-check=full to see details of leaked memory
==22991== 
==22991== For counts of detected and suppressed errors, rerun with: -v
==22991== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 6)
#####

Are your concerns addressed?  If so, then we can close this RT.

Thank you very much.
Jim Keenan


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=72406

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