diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-06-26 00:18:03 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-06-26 01:12:10 -0700 |
commit | 20d5dc239d1bc8440adfec25faf617e0e444f64e (patch) | |
tree | 8ebab95b5783396ff210544b5e03d3317dfd7706 /pp_sort.c | |
parent | ae3f739188e3ee21fa593cafc28023c533e8d9bf (diff) | |
download | perl-20d5dc239d1bc8440adfec25faf617e0e444f64e.tar.gz |
In-place sort should not leave array read-only
$ ./perl -Ilib -e '@a=1..2; eval { @a=sort{die} @a }; warn "ok so far\n"; @a = 1'
ok so far
Modification of a read-only value attempted at -e line 1.
If something goes wrong inside the sort block and it dies, we still
need to make sure we turn off the read-only flag on that array.
Diffstat (limited to 'pp_sort.c')
-rw-r--r-- | pp_sort.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -1588,7 +1588,10 @@ PP(pp_sort) if (SvREADONLY(av)) Perl_croak_no_modify(); else + { SvREADONLY_on(av); + save_pushptr((void *)av, SAVEt_READONLY_OFF); + } p1 = p2 = AvARRAY(av); sorting_av = 1; } |