[glib] g_utf8_validate: fix a regression



commit d1f4d4a91a5274a33a0aee0748851bce7fbffa23
Author: Mikhail Zabaluev <mikhail zabaluev gmail com>
Date:   Sat Sep 12 11:06:53 2015 +0300

    g_utf8_validate: fix a regression
    
    A recent change permitted some characters from range 0x80-0xbf as
    would-be valid sequence starters for length 2, as long as
    continuation characters were OK.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=738504

 glib/gutf8.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/glib/gutf8.c b/glib/gutf8.c
index f48ed4a..4675800 100644
--- a/glib/gutf8.c
+++ b/glib/gutf8.c
@@ -1482,7 +1482,7 @@ fast_validate (const char *str)
          last = p;
          if (*(guchar *)p < 0xe0) /* 110xxxxx */
            {
-             if (G_UNLIKELY ((*(guchar *)p & 0x1e) == 0))
+             if (G_UNLIKELY (*(guchar *)p < 0xc2))
                goto error;
            }
          else
@@ -1559,7 +1559,7 @@ fast_validate_len (const char *str,
              if (G_UNLIKELY (max_len - (p - str) < 2))
                goto error;
              
-             if (G_UNLIKELY ((*(guchar *)p & 0x1e) == 0))
+             if (G_UNLIKELY (*(guchar *)p < 0xc2))
                goto error;
            }
          else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]