mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-02 07:36:17 +01:00
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
This commit is contained in:
parent
a51a877d27
commit
d1f4d4a91a
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user