diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-08-04 23:52:20 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-08-05 02:23:32 -0700 |
commit | 1311cfc0a7b1bfcfd292948a7d88f0536e2e1c6e (patch) | |
tree | fe9d317395e79df6ab9877f3cd8e8e66aa5ab3f8 /cop.h | |
parent | c82ecf346a8512f22f25188e450d92938c245421 (diff) | |
download | perl-1311cfc0a7b1bfcfd292948a7d88f0536e2e1c6e.tar.gz |
Prevent __FILE__ corruption when ${"_<..."} is modified
This fixes a longstanding bug under non-threaded builds that was
extended to threaded builds by the previous commit.
Modifying the SV slot of the file gv can cause CopFILE to violate
memory discipline, giving random strings.
Since the GV is named after the file, too, and since its name can-
not be changed from Perl space, use that for CopFILE instead.
Diffstat (limited to 'cop.h')
-rw-r--r-- | cop.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -429,8 +429,8 @@ struct cop { #define CopFILESV(c) (CopFILEGV(c) ? GvSV(CopFILEGV(c)) : NULL) #define CopFILEAV(c) (CopFILEGV(c) ? GvAV(CopFILEGV(c)) : NULL) #define CopFILEAVx(c) (assert_(CopFILEGV(c)) GvAV(CopFILEGV(c))) -#define CopFILE(c) (CopFILEGV(c) && GvSV(CopFILEGV(c)) \ - ? SvPVX(GvSV(CopFILEGV(c))) : NULL) +#define CopFILE(c) (CopFILEGV(c) \ + ? GvNAME(CopFILEGV(c))+2 : NULL) #define CopSTASHPV(c) (CopSTASH(c) ? HvNAME_get(CopSTASH(c)) : NULL) /* cop_stash is not refcounted */ #define CopSTASHPV_set(c,pv) CopSTASH_set((c), gv_stashpv(pv,GV_ADD)) |