From 1f1a6e4688ff764ec0ae257cdc79a5374937af88 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Thu, 26 Apr 2007 20:43:13 +0000 Subject: [PATCH] Avoid a SIGBUS caused by passing a U32 pointer to utf8_to_uvchr(), which expects a STRLEN pointer. Avoid some signed/unsigned casting warnings by adding casts. p4raw-id: //depot/perl@31093 --- regcomp.c | 2 +- regexec.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/regcomp.c b/regcomp.c index 40b2ac1..80aa335 100644 --- a/regcomp.c +++ b/regcomp.c @@ -6576,7 +6576,7 @@ tryagain: case 0xC3: case 0xCE: if (FOLD && is_TRICKYFOLD(RExC_parse,UTF)) { - U32 len = UTF ? 0 : 1; + STRLEN len = UTF ? 0 : 1; U32 cp = UTF ? utf8_to_uvchr((U8*)RExC_parse, &len) : (U32)((U8*)RExC_parse)[0]; *flagp |= HASWIDTH; /* could be SIMPLE too, but needs a handler in regexec.regrepeat */ RExC_parse+=len; diff --git a/regexec.c b/regexec.c index 374d480..79fab43 100644 --- a/regexec.c +++ b/regexec.c @@ -5022,8 +5022,9 @@ NULL U8 tmpbuf2[UTF8_MAXBYTES_CASE+1]; STRLEN tmplen2; to_uni_fold(n, tmpbuf1, &tmplen1); - to_utf8_fold(locinput, tmpbuf2, &tmplen2); - if (tmplen1!=tmplen2 || !strnEQ(tmpbuf1,tmpbuf2,tmplen1)) + to_utf8_fold((U8*)locinput, tmpbuf2, &tmplen2); + if (tmplen1!=tmplen2 + || !strnEQ((char *)tmpbuf1,(char *)tmpbuf2,tmplen1)) sayNO; else locinput += UTF8SKIP(locinput); -- 2.7.4