[glib/wip/carlosg/utf8-strreverse-invalid-writes] gutf8: Assert that written memory stays in bounds
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/carlosg/utf8-strreverse-invalid-writes] gutf8: Assert that written memory stays in bounds
- Date: Wed, 7 Aug 2019 21:34:29 +0000 (UTC)
commit 154f6cafa90c9fa77208cf1815a6f421c9eceb64
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Aug 7 23:18:42 2019 +0200
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
glib/gutf8.c | 1 +
1 file changed, 1 insertion(+)
---
diff --git a/glib/gutf8.c b/glib/gutf8.c
index a19f72044..fe0f8ab14 100644
--- a/glib/gutf8.c
+++ b/glib/gutf8.c
@@ -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++;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]