Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion av.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ Perl_av_store(pTHX_ AV *av, SSize_t key, SV *val)
return NULL;
}

if (SvREADONLY(av) && key >= AvFILL(av))
if (SvREADONLY(av) && key > AvFILL(av))
croak_no_modify();

if (!AvREAL(av) && AvREIFY(av))
Expand Down
14 changes: 13 additions & 1 deletion t/op/array.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ BEGIN {
set_up_inc('.', '../lib');
}

plan (198);
plan (199);

#
# @foo, @bar, and @ary are also used from tie-stdarray after tie-ing them
Expand Down Expand Up @@ -734,3 +734,15 @@ fresh_perl_is('my @x;$x[0] = 1;shift @x;$x[22] = 1;$x[25] = 1;','',
is($arr[1], 3,
'Array element within array range created at correct index from subroutine @_ alias; GH 16364');
}

# regression test for GH #24006
{
use feature qw(refaliasing);
no warnings 'experimental::refaliasing';
my @arr = (1, 2);
Internals::SvREADONLY(@arr, 1);

eval { \$arr[1] = \42 };
ok !$@, "Last element's contents of a readonly array can be modified";
}

Loading