Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: (Golf) Segfault Perl

by ariels (Curate)
on Apr 04, 2002 at 12:20 UTC ( [id://156637]=note: print w/replies, xml ) Need Help??


in reply to (Golf) Segfault Perl

Going through perlvar, I found this. It segfaults, depending on how exactly Perl was compiled, and maybe a few more things...

12345678901234567 perl -e'$^M=1;$x[1<<30]=2'

Thrill as memory leaks away! Laugh as Perl attempts to recover using a single byte of memory! (Cry if your Perl was compiled without this silly feature.)

Replies are listed 'Best First'.
Re: Re: (Golf) Segfault Perl
by Juerd (Abbot) on Apr 04, 2002 at 12:28 UTC

    perl -e'$^M=1;$x[1<<30]=2'

    Segfaults without setting $^M too.

    #2345678901 $x[1<<30]=2

    U28geW91IGNhbiBhbGwgcm90MTMgY
    W5kIHBhY2soKS4gQnV0IGRvIHlvdS
    ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
    geW91IHNlZSBpdD8gIC0tIEp1ZXJk
    

      Shave another byte: $x[~0/2]=1

      _____________________________________________________
      Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a (from-home) job
      s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

        Interesting:
          
        . . (root@tiger:~)$ perl -e'$x[2147483645]++' Out of memory! (root@tiger:~)$ perl -e'$x[2147483646]++' Out of memory! (root@tiger:~)$ perl -e'$x[2147483647]++' Segmentation fault (root@tiger:~)$ perl -e'$x[2147483648]++' Modification of non-creatable array value attempted, subscript -214748 +3648 at -e line 1. (root@tiger:~)$ perl -e'$x[2147483649]++' Modification of non-creatable array value attempted, subscript -214748 +3647 at -e line 1. . .
           MeowChow                                   
                       s aamecha.s a..a\u$&owag.print

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://156637]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-20 04:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found