diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2002-02-01 05:17:59 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-02-01 05:17:59 +0000 |
commit | a6872d423f27ca69297bf4e6466ce19b6475dbcf (patch) | |
tree | a953916d6b121a8949bc7767b3dbc8962e6f95fa /utf8.c | |
parent | e54d2dfa4791be271f65522bd8896292a87cdd6f (diff) | |
download | perl-a6872d423f27ca69297bf4e6466ce19b6475dbcf.tar.gz |
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)
p4raw-id: //depot/perl@14511
Diffstat (limited to 'utf8.c')
-rw-r--r-- | utf8.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1285,7 +1285,7 @@ to the hash is by Perl_to_utf8_case(). */ 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 @@ Perl_to_utf8_case(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp, SV **swashp,char *normal 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 @@ Perl_ibcmp_utf8(pTHX_ const char *s1, char **pe1, register UV l1, bool u1, const 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) && |