diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-05-19 10:14:16 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-05-19 10:14:16 +0100 |
commit | 5d59f95a83d2d9d7301ce45f2d288c286a51219b (patch) | |
tree | 95b940d44e1601538a9e07fc19d45575cf1fedbf /pp.c | |
parent | 5f57559b4e9559e982a8b8ab826c0a0cef6ee4b2 (diff) | |
download | perl-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.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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); |