diff options
author | David Mitchell <davem@iabyn.com> | 2016-12-26 12:49:24 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2016-12-26 12:49:24 +0000 |
commit | d720149d59afad1fa0ae15d5f092fdc47bd1a4f7 (patch) | |
tree | 0ed8e2693265e5871d4672ae5a4412ee3f82b32f /pp.c | |
parent | 6b776407d46448d59a69054c8cd4cec4d91f50c0 (diff) | |
download | perl-d720149d59afad1fa0ae15d5f092fdc47bd1a4f7.tar.gz |
split ' ', $foo: don't check end byte
The special-cased code to skip spaces at the start of the string
didn't check that s < strend, so relied on the string being \0-terminated
to work correctly. The introduction of the isSPACE_utf8_safe() macro
showed up this dodgy assumption by causing assert failures in regen.t
under LC_ALL=en_US.UTF-8 PERL_UNICODE="".
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -5794,15 +5794,15 @@ PP(pp_split) orig = s; if (RX_EXTFLAGS(rx) & RXf_SKIPWHITE) { if (do_utf8) { - while (isSPACE_utf8_safe(s, strend)) + while (s < strend && isSPACE_utf8_safe(s, strend)) s += UTF8SKIP(s); } else if (get_regex_charset(RX_EXTFLAGS(rx)) == REGEX_LOCALE_CHARSET) { - while (isSPACE_LC(*s)) + while (s < strend && isSPACE_LC(*s)) s++; } else { - while (isSPACE(*s)) + while (s < strend && isSPACE(*s)) s++; } } |