diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-07-26 01:26:54 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-08-25 12:25:23 -0700 |
commit | 35995e5cabcbf47f272bbb0fb290908515c1d776 (patch) | |
tree | 4ac6fe162e158e5b465168b2e628ab2d5cdefd29 /mg.c | |
parent | 232af1f839acc29d9ac336d13ff67802d236c38b (diff) | |
download | perl-35995e5cabcbf47f272bbb0fb290908515c1d776.tar.gz |
Fix assert fail when fetching pos clobbers ref with undef
pos($x) returns a special magical scalar that sets the match position
on $x. Calling pos($x) twice will provide two such scalars. If we
set one of them to a reference, set the other to undef, and then read
the first, all hail breaks loose, because of the use of SvOK_off.
SvOK_off is not sufficient if arbitrary values can be assigned by Perl
code. Globs, refs and regexps (among others) need special handling,
which sv_setsv knows how to do.
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -2105,7 +2105,7 @@ Perl_magic_getpos(pTHX_ SV *sv, MAGIC *mg) sv_setuv(sv, i); return 0; } - SvOK_off(sv); + sv_setsv(sv,NULL); return 0; } |