Skip to content

Commit

Permalink
g_utf8_validate: fix a regression
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mzabaluev authored and Matthias Clasen committed Sep 13, 2015
1 parent a51a877 commit d1f4d4a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions glib/gutf8.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d1f4d4a

Please sign in to comment.