mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-18 11:41:58 +02: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;
|
last = p;
|
||||||
if (*(guchar *)p < 0xe0) /* 110xxxxx */
|
if (*(guchar *)p < 0xe0) /* 110xxxxx */
|
||||||
{
|
{
|
||||||
if (G_UNLIKELY ((*(guchar *)p & 0x1e) == 0))
|
if (G_UNLIKELY (*(guchar *)p < 0xc2))
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1559,7 +1559,7 @@ fast_validate_len (const char *str,
|
|||||||
if (G_UNLIKELY (max_len - (p - str) < 2))
|
if (G_UNLIKELY (max_len - (p - str) < 2))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (G_UNLIKELY ((*(guchar *)p & 0x1e) == 0))
|
if (G_UNLIKELY (*(guchar *)p < 0xc2))
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user