- Add patchset to fix gvariant parsing issues. (bsc#1111499). 0001-gvariant-Fix-checking-arithmetic-for-tuple-element-e.patch 0002-gvarianttype-Impose-a-recursion-limit-of-64-on-varia.patch 0003-gvariant-Check-array-offsets-against-serialised-data.patch 0004-gvariant-Check-tuple-offsets-against-serialised-data.patch 0005-gvariant-Limit-GVariant-strings-to-G_MAXSSIZE.patch 0006-gdbusmessage-Validate-type-of-message-header-signatu.patch 0007-gdbusmessage-Improve-documentation-for-g_dbus_messag.patch 0008-gdbusmessage-Clarify-error-returns-for-g_dbus_messag.patch 0009-gdbusmessage-Fix-a-typo-in-a-documentation-comment.patch 0010-gdbusmessage-Check-for-valid-GVariantType-when-parsi.patch 0011-gvariant-Clarify-internal-documentation-about-GVaria.patch 0012-tests-Tidy-up-GError-handling-in-gdbus-serialization.patch 0013-tests-Use-g_assert_null-in-gdbus-serialization-test.patch 0014-gutf8-Add-a-g_utf8_validate_len-function.patch 0015-glib-Port-various-callers-to-use-g_utf8_validate_len.patch OBS-URL: https://build.opensuse.org/request/show/644162 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/glib2?expand=0&rev=370
89 lines
3.1 KiB
Diff
89 lines
3.1 KiB
Diff
From c23efe320561d99edc4cd066317b5a5b131c7004 Mon Sep 17 00:00:00 2001
|
||
From: Philip Withnall <withnall@endlessm.com>
|
||
Date: Thu, 4 Oct 2018 13:22:13 +0100
|
||
Subject: [PATCH 15/15] glib: Port various callers to use g_utf8_validate_len()
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
These were callers which explicitly specified the string length to
|
||
g_utf8_validate(), when it couldn’t be negative, and hence should be
|
||
able to unconditionally benefit from the increased string handling
|
||
length.
|
||
|
||
At least one call site would have previously silently changed behaviour
|
||
if called with strings longer than G_MAXSSIZE in length.
|
||
|
||
Another call site was passing strlen(string) to g_utf8_validate(), which
|
||
seems pointless: just pass -1 instead, and let g_utf8_validate()
|
||
calculate the string length. Its behaviour on embedded nul bytes
|
||
wouldn’t change, as strlen() stops at the first one.
|
||
|
||
Signed-off-by: Philip Withnall <withnall@endlessm.com>
|
||
---
|
||
gio/glocalfileinfo.c | 4 ++--
|
||
glib/giochannel.c | 2 +-
|
||
glib/gmarkup.c | 4 ++--
|
||
3 files changed, 5 insertions(+), 5 deletions(-)
|
||
|
||
diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c
|
||
index ed7e99400..59cfb9ba9 100644
|
||
--- a/gio/glocalfileinfo.c
|
||
+++ b/gio/glocalfileinfo.c
|
||
@@ -1063,7 +1063,7 @@ make_valid_utf8 (const char *name)
|
||
{
|
||
GString *string;
|
||
const gchar *remainder, *invalid;
|
||
- gint remaining_bytes, valid_bytes;
|
||
+ gsize remaining_bytes, valid_bytes;
|
||
|
||
string = NULL;
|
||
remainder = name;
|
||
@@ -1071,7 +1071,7 @@ make_valid_utf8 (const char *name)
|
||
|
||
while (remaining_bytes != 0)
|
||
{
|
||
- if (g_utf8_validate (remainder, remaining_bytes, &invalid))
|
||
+ if (g_utf8_validate_len (remainder, remaining_bytes, &invalid))
|
||
break;
|
||
valid_bytes = invalid - remainder;
|
||
|
||
diff --git a/glib/giochannel.c b/glib/giochannel.c
|
||
index d8c3b0b09..88fd8c81d 100644
|
||
--- a/glib/giochannel.c
|
||
+++ b/glib/giochannel.c
|
||
@@ -2323,7 +2323,7 @@ reconvert:
|
||
|
||
/* UTF-8, just validate, emulate g_iconv */
|
||
|
||
- if (!g_utf8_validate (from_buf, try_len, &badchar))
|
||
+ if (!g_utf8_validate_len (from_buf, try_len, &badchar))
|
||
{
|
||
gunichar try_char;
|
||
gsize incomplete_len = from_buf + try_len - badchar;
|
||
diff --git a/glib/gmarkup.c b/glib/gmarkup.c
|
||
index 43bb0c7f8..9b15b1281 100644
|
||
--- a/glib/gmarkup.c
|
||
+++ b/glib/gmarkup.c
|
||
@@ -455,7 +455,7 @@ slow_name_validate (GMarkupParseContext *context,
|
||
{
|
||
const gchar *p = name;
|
||
|
||
- if (!g_utf8_validate (name, strlen (name), NULL))
|
||
+ if (!g_utf8_validate (name, -1, NULL))
|
||
{
|
||
set_error (context, error, G_MARKUP_ERROR_BAD_UTF8,
|
||
_("Invalid UTF-8 encoded text in name — not valid “%s”"), name);
|
||
@@ -538,7 +538,7 @@ text_validate (GMarkupParseContext *context,
|
||
gint len,
|
||
GError **error)
|
||
{
|
||
- if (!g_utf8_validate (p, len, NULL))
|
||
+ if (!g_utf8_validate_len (p, len, NULL))
|
||
{
|
||
set_error (context, error, G_MARKUP_ERROR_BAD_UTF8,
|
||
_("Invalid UTF-8 encoded text in name — not valid “%s”"), p);
|
||
--
|
||
2.14.4
|
||
|