summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2010-01-18 21:57:01 +0100
committerSteffen Mueller <smueller@cpan.org>2010-01-18 22:41:00 +0100
commit1f730e6c11736bad913e605b064200a67117e898 (patch)
treec8e99c4c5417c1fd7bd1e2560515cb44c8af0461 /mg.c
parent80a0006a93e118d82351c89f52d7433793784e94 (diff)
downloadperl-1f730e6c11736bad913e605b064200a67117e898.tar.gz
Fix for #71254: SEGV in Data::Dumper
This was caused by change 27323/f7877b281b4, which changes the way globs are stored in SVs. This patch teaches Perl_magic_setmglob (which resets the match position after an assignment) about globs. What was happening was that the globness was turned off (with the type still as PVGV), which essentially turned the variable into a strange empty string. Data::Dumper, seeing a PVGV, assumes the string form is at least 1 char (which should always be the case), and ends up reading past the end of the string if it is blank.
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mg.c b/mg.c
index 1728752db8..b9a1464938 100644
--- a/mg.c
+++ b/mg.c
@@ -2217,7 +2217,8 @@ Perl_magic_setmglob(pTHX_ SV *sv, MAGIC *mg)
PERL_ARGS_ASSERT_MAGIC_SETMGLOB;
PERL_UNUSED_CONTEXT;
mg->mg_len = -1;
- SvSCREAM_off(sv);
+ if (!isGV_with_GP(sv))
+ SvSCREAM_off(sv);
return 0;
}