summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-05-19 10:14:16 +0100
committerNicholas Clark <nick@ccl4.org>2011-05-19 10:14:16 +0100
commit5d59f95a83d2d9d7301ce45f2d288c286a51219b (patch)
tree95b940d44e1601538a9e07fc19d45575cf1fedbf /pp.c
parent5f57559b4e9559e982a8b8ab826c0a0cef6ee4b2 (diff)
downloadperl-5d59f95a83d2d9d7301ce45f2d288c286a51219b.tar.gz
study uses I32 internally for offsets, so should be skipped for long strings.
It already skips for anything that isn't a plain byte string with non-zero length. Otherwise it risks becoming confused for strings longer than 2**31.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pp.c b/pp.c
index 0069fbabcf..3cfbe1aa2e 100644
--- a/pp.c
+++ b/pp.c
@@ -712,8 +712,7 @@ PP(pp_study)
RETPUSHYES;
}
s = (unsigned char*)(SvPV(sv, len));
- pos = len;
- if (pos <= 0 || !SvPOK(sv) || SvUTF8(sv)) {
+ if (len == 0 || len > I32_MAX || !SvPOK(sv) || SvUTF8(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
@@ -721,6 +720,7 @@ PP(pp_study)
stringification. */
RETPUSHNO;
}
+ pos = len;
if (PL_lastscream) {
SvSCREAM_off(PL_lastscream);