diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2002-02-11 01:53:01 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-02-11 01:53:01 +0000 |
commit | 9dc45d57a9216877b08d137c07effd664b49bda8 (patch) | |
tree | 33ac9994f4f40d48d1560a559675c726edf2c9aa /regcomp.c | |
parent | 4865a36daa1b2556054c8fc5515c6d3ea3656997 (diff) | |
download | perl-9dc45d57a9216877b08d137c07effd664b49bda8.tar.gz |
"Can't happen" - yes, it can, with buggy UTF-8/EBCDIC.
Stepping backward in the string would be majorly bad.
p4raw-id: //depot/perl@14633
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 36 |
1 files changed, 24 insertions, 12 deletions
@@ -3188,16 +3188,22 @@ tryagain: foldlen; foldlen -= numlen) { ender = utf8_to_uvchr(foldbuf, &numlen); - reguni(pRExC_state, ender, s, &numlen); - s += numlen; - len += numlen; - foldbuf += numlen; + if (numlen > 0) { + reguni(pRExC_state, ender, s, &numlen); + s += numlen; + len += numlen; + foldbuf += numlen; + } + else + break; /* "Can't happen." */ } } else { reguni(pRExC_state, ender, s, &numlen); - s += numlen; - len += numlen; + if (numlen > 0) { + s += numlen; + len += numlen; + } } } else { @@ -3213,16 +3219,22 @@ tryagain: foldlen; foldlen -= numlen) { ender = utf8_to_uvchr(foldbuf, &numlen); - reguni(pRExC_state, ender, s, &numlen); - s += numlen; - len += numlen; - foldbuf += numlen; + if (numlen > 0) { + reguni(pRExC_state, ender, s, &numlen); + s += numlen; + len += numlen; + foldbuf += numlen; + } + else + break; } } else { reguni(pRExC_state, ender, s, &numlen); - s += numlen; - len += numlen; + if (numlen > 0) { + s += numlen; + len += numlen; + } } len--; } |