summaryrefslogtreecommitdiff
path: root/sv.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-06-28 17:14:45 +0100
committerNicholas Clark <nick@ccl4.org>2010-06-30 09:11:17 +0100
commit5bb89d25eef36595e8b2275f7b0739655e3535d5 (patch)
treefda83110d4652e0502eebfe7fc2d73eceac777b1 /sv.h
parent8a0cff6917bc9219abe47c208f7b997d8eb6d7a5 (diff)
downloadperl-5bb89d25eef36595e8b2275f7b0739655e3535d5.tar.gz
Only allow SvPVX() on SVt_PVIO when IOf_FAKE_DIRP is set.
Diffstat (limited to 'sv.h')
-rw-r--r--sv.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/sv.h b/sv.h
index 9c6dfd866c..adadab36cb 100644
--- a/sv.h
+++ b/sv.h
@@ -547,7 +547,8 @@ struct xpvio {
#define IOf_DIDTOP 8 /* just did top of form */
#define IOf_UNTAINT 16 /* consider this fp (and its data) "safe" */
#define IOf_NOLINE 32 /* slurped a pseudo-line from empty file */
-#define IOf_FAKE_DIRP 64 /* xio_dirp is fake (source filters kludge) */
+#define IOf_FAKE_DIRP 64 /* xio_dirp is fake (source filters kludge)
+ Also, when this is set, SvPVX() is valid */
/* The following macros define implementation-independent predicates on SVs. */
@@ -1043,6 +1044,8 @@ the scalar's value cannot change unless written to.
assert(SvTYPE(_svpvx) != SVt_PVAV); \
assert(SvTYPE(_svpvx) != SVt_PVHV); \
assert(!isGV_with_GP(_svpvx)); \
+ assert(!(SvTYPE(_svpvx) == SVt_PVIO \
+ && !(IoFLAGS(_svpvx) & IOf_FAKE_DIRP))); \
&((_svpvx)->sv_u.svu_pv); \
}))
# define SvCUR(sv) \