summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSADAHIRO Tomoyuki <BQW10602@nifty.com>2005-12-06 09:35:52 +0900
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2005-12-05 16:04:16 +0000
commit19f6729910f1cd22aa33cc8443fa168b7813bd95 (patch)
tree5840f4d25257cb758fb6b9c3b667c95acd25e72a
parent680c470ce925e5af5a9ca87f342016c7363e36fd (diff)
downloadperl-19f6729910f1cd22aa33cc8443fa168b7813bd95.tar.gz
Re: [perl #37836] Simple Regex causes SEGV when run on specific data
Message-Id: <20051206003221.5AD9.BQW10602@nifty.com> p4raw-id: //depot/perl@26258
-rw-r--r--regexec.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/regexec.c b/regexec.c
index b0ba851340..13cc68bf49 100644
--- a/regexec.c
+++ b/regexec.c
@@ -4710,9 +4710,13 @@ S_reginclass(pTHX_ register const regnode *n, register const U8* p, STRLEN* lenp
STRLEN len = 0;
STRLEN plen;
- if (do_utf8 && !UTF8_IS_INVARIANT(c))
- c = utf8n_to_uvchr(p, UTF8_MAXBYTES, &len,
- ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY);
+ if (do_utf8 && !UTF8_IS_INVARIANT(c)) {
+ c = utf8n_to_uvchr(p, UTF8_MAXBYTES, &len,
+ ckWARN(WARN_UTF8) ? UTF8_CHECK_ONLY :
+ UTF8_ALLOW_ANYUV|UTF8_CHECK_ONLY);
+ if (len == (STRLEN)-1)
+ Perl_croak(aTHX_ "Malformed UTF-8 character (fatal)");
+ }
plen = lenp ? *lenp : UNISKIP(NATIVE_TO_UNI(c));
if (do_utf8 || (flags & ANYOF_UNICODE)) {