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

[perl #7567] sort stupidness caused segfault

From:
Father Chrysostomos via RT
Date:
June 26, 2013 08:16
Subject:
[perl #7567] sort stupidness caused segfault
Message ID:
rt-3.6.HEAD-2552-1372234581-634.7567-15-0@perl.org
On Wed Dec 14 18:37:46 2005, stmpeters wrote:
> > [root@ws.com.au - Tue Aug 21 14:53:01 2001]:
> >
> >
> > -----------------------------------------------------------------
> > [Please enter your report here]
> >
> > just stuffing around being stupid with sort {} and ..
> >
> > gateway:~/tmp# cat rand
> > #!/usr/bin/perl
> > @a = (1, 2, 3, 4, 5, 6, 7, 8, 9);
> > @a = sort {
> >         @a = sort {
> >                 @a = sort {
> >                         @a = sort {
> >                                 int rand (2) - 2;
> >                         }
> >                         int rand (2) - 2;
> >                 }
> >                 int rand (2) - 2;
> >         } @a;
> >         int rand (2) - 2;
> > } @a;
> > print join '', @a;
> > gateway:~/tmp# ./rand
> > Segmentation fault
> >
> 
> This bug has been fixed by making it illegal to attempt to modify an
> array while sorting it.
> This was fixed with change #25953.

(aka 9850bf2)

But that also caused the array to stay read-only after an attempt to
modify it caused a croak.  I fixed that in commit 20d5dc239d.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: resolved
https://rt.perl.org:443/rt3/Ticket/Display.html?id=7567



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About