mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-15 20:25:12 +01:00
gutf8: Assert that written memory stays in bounds
You may expect funny effects from passing invalid UTF-8, but not that funny. The assert will probably be a better and more immediate confirmation of an error than invalid writes under the address of the string copy. https://gitlab.gnome.org/GNOME/glib/issues/1863
This commit is contained in:
parent
179fdc5239
commit
154f6cafa9
@ -1773,6 +1773,7 @@ g_utf8_strreverse (const gchar *str,
|
||||
{
|
||||
gchar *m, skip = g_utf8_skip[*(guchar*) p];
|
||||
r -= skip;
|
||||
g_assert (r >= result);
|
||||
for (m = r; skip; skip--)
|
||||
*m++ = *p++;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user