UTF-8 decoder tweak.
Jarkko Hietaniemi [Sun, 29 Oct 2000 17:02:37 +0000 (17:02 +0000)]
p4raw-id: //depot/perl@7481

utf8.c

diff --git a/utf8.c b/utf8.c
index 80f8846..9ac63a6 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -210,7 +210,7 @@ Perl_utf8_to_uv(pTHX_ U8* s, STRLEN curlen, STRLEN* retlen, U32 flags)
        goto malformed;
     }
 
-    if ((uv >= 0xc0 && uv <= 0xfd && s[1] < 0x80) &&
+    if ((uv >= 0xc0 && uv <= 0xfd && curlen >1 && s[1] < 0x80) &&
        !(flags & UTF8_ALLOW_NON_CONTINUATION)) {
        if (dowarn)
            Perl_warner(aTHX_ WARN_UTF8,