Change 14511 by jhi@alpha on 2002/02/01 05:17:59
The Malformed UTF-8 Heisenbug seen by Merijn and NickC
I got it in Tru64 + ithreads but only without -g, took
some debugging by printf (which was no fun either since
adding some debug printfs hid the error)
Affected files ...
.... //depot/perl/regexec.c#256 edit
.... //depot/perl/utf8.c#157 edit
Differences ...
==== //depot/perl/regexec.c#256 (text) ====
Index: perl/regexec.c
--- perl/regexec.c.~1~ Thu Jan 31 22:30:05 2002
+++ perl/regexec.c Thu Jan 31 22:30:05 2002
@@ -1043,7 +1043,7 @@
if ( f != c
&& (f == c1 || f == c2)
&& (ln == foldlen ||
- !ibcmp_utf8((char *)foldbuf,
+ !ibcmp_utf8((char *) foldbuf,
(char **)0, foldlen, do_utf8,
m,
(char **)0, ln, UTF))
==== //depot/perl/utf8.c#157 (text) ====
Index: perl/utf8.c
--- perl/utf8.c.~1~ Thu Jan 31 22:30:05 2002
+++ perl/utf8.c Thu Jan 31 22:30:05 2002
@@ -1285,7 +1285,7 @@
*/
UV
-Perl_to_utf8_case(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp, SV **swashp,char *normal,
char *special)
+Perl_to_utf8_case(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp, SV **swashp, char *normal,
+char *special)
{
UV uv;
@@ -1305,6 +1305,7 @@
SV *val = HeVAL(he);
char *s = SvPV(val, *lenp);
U8 c = *(U8*)s;
+
if (*lenp > 1 || UNI_IS_INVARIANT(c))
Copy(s, ustrp, *lenp, U8);
else {
@@ -1807,6 +1808,9 @@
if ((e1 == 0 && f1 == 0) || (e2 == 0 && f2 == 0) || (f1 == 0 && f2 == 0))
return 1; /* mismatch; possible infinite loop or false positive */
+ if (!u1 || !u2)
+ natbuf[1] = 0; /* Need to terminate the buffer. */
+
while ((e1 == 0 || p1 < e1) &&
(f1 == 0 || p1 < f1) &&
(e2 == 0 || p2 < e2) &&
End of Patch.