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:
Mikhail Zabaluev 2015-09-12 11:06:53 +03:00 committed by Matthias Clasen
parent a51a877d27
commit d1f4d4a91a

View File

@ -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