summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-05-23 21:36:06 +0100
committerNicholas Clark <nick@ccl4.org>2011-06-11 09:40:01 +0200
commitbc9a525687b7ccee10de7bc6f6a729645b1058dd (patch)
tree2221f1debd001579230e38ef1a3673cd26890cd6 /pp.c
parentccbcbb3d6584c01ff4c18f0e39e86d6eb181eb4d (diff)
downloadperl-bc9a525687b7ccee10de7bc6f6a729645b1058dd.tar.gz
Don't allow study on an FBM scalar, to give more flexibility in SV flag usage.
No real-world code would ever end up studying an FBM scalar, so this isn't a real pessimisation.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/pp.c b/pp.c
index 3673abdacf..385f1beef1 100644
--- a/pp.c
+++ b/pp.c
@@ -718,12 +718,15 @@ PP(pp_study)
RETPUSHYES;
}
s = (unsigned char*)(SvPV(sv, len));
- if (len == 0 || len > I32_MAX || !SvPOK(sv) || SvUTF8(sv)) {
+ if (len == 0 || len > I32_MAX || !SvPOK(sv) || SvUTF8(sv) || SvVALID(sv)) {
/* No point in studying a zero length string, and not safe to study
anything that doesn't appear to be a simple scalar (and hence might
change between now and when the regexp engine runs without our set
magic ever running) such as a reference to an object with overloaded
- stringification. */
+ stringification. Also refuse to study an FBM scalar, as this gives
+ more flexibility in SV flag usage. No real-world code would ever
+ end up studying an FBM scalar, so this isn't a real pessimisation.
+ */
RETPUSHNO;
}
pos = len;