- Update to version 2.66.6: + Fix various instances within GLib where `g_memdup()` was vulnerable to a silent integer truncation and heap overflow problem (glgo#GNOME/GLib#2319). - Update to version 2.66.5: + Fix some issues with handling over-long (invalid) input when parsing for `GDate`. + Don’t load GIO modules or parse other GIO environment variables when `AT_SECURE` is set (i.e. in a setuid/setgid/setcap process). GIO has always been documented as not being safe to use in privileged processes, but people persist in using it unsafely, so these changes should harden things against potential attacks at least a little. Unfortunately they break a couple of projects which were relying on reading `DBUS_SESSION_BUS_ADDRESS`, so GIO continues to read that for setgid/setcap (but not setuid) processes. This loophole will be closed in GLib 2.70 (see issue #2316), which should give modules 6 months to change their behaviour. + Fix `g_spawn()` searching `PATH` when it wasn’t meant to. + Bugs fixed: bgo#2168, bgo#2210, bgo#2305, glgo#GNOME/GLib!1820, glgo#GNOME/GLib!1824, glgo#GNOME/GLib!1831, glgo#GNOME/GLib!1836, glgo#GNOME/GLib!1864, glgo#GNOME/GLib!1872, glgo#GNOME/GLib!1913, glgo#GNOME/GLib!1922. - Rebase/refresh patches: + glib2-dbus-socket-path.patch + glib2-fate300461-gettext-gkeyfile-suse.patch + glib2-gdbus-codegen-version.patch + glib2-suppress-schema-deprecated-path-warning.patch OBS-URL: https://build.opensuse.org/request/show/869723 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/glib2?expand=0&rev=444
143 lines
4.9 KiB
Diff
143 lines
4.9 KiB
Diff
Index: glib-2.66.5/glib/gkeyfile.c
|
|
===================================================================
|
|
--- glib-2.66.5.orig/glib/gkeyfile.c
|
|
+++ glib-2.66.5/glib/gkeyfile.c
|
|
@@ -511,6 +511,7 @@ struct _GKeyFile
|
|
GKeyFileFlags flags;
|
|
|
|
gchar **locales;
|
|
+ gchar *gettext_domain;
|
|
|
|
volatile gint ref_count;
|
|
};
|
|
@@ -636,6 +637,7 @@ g_key_file_init (GKeyFile *key_file)
|
|
key_file->list_separator = ';';
|
|
key_file->flags = 0;
|
|
key_file->locales = g_strdupv ((gchar **)g_get_language_names ());
|
|
+ key_file->gettext_domain = NULL;
|
|
}
|
|
|
|
static void
|
|
@@ -655,6 +657,12 @@ g_key_file_clear (GKeyFile *key_file)
|
|
key_file->parse_buffer = NULL;
|
|
}
|
|
|
|
+ if (key_file->gettext_domain)
|
|
+ {
|
|
+ g_free (key_file->gettext_domain);
|
|
+ key_file->gettext_domain = NULL;
|
|
+ }
|
|
+
|
|
tmp = key_file->groups;
|
|
while (tmp != NULL)
|
|
{
|
|
@@ -874,6 +882,11 @@ g_key_file_load_from_fd (GKeyFile
|
|
return FALSE;
|
|
}
|
|
|
|
+ key_file->gettext_domain = g_key_file_get_string (key_file,
|
|
+ G_KEY_FILE_DESKTOP_GROUP,
|
|
+ G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN,
|
|
+ NULL);
|
|
+
|
|
return TRUE;
|
|
}
|
|
|
|
@@ -986,6 +999,11 @@ g_key_file_load_from_data (GKeyFile
|
|
return FALSE;
|
|
}
|
|
|
|
+ key_file->gettext_domain = g_key_file_get_string (key_file,
|
|
+ G_KEY_FILE_DESKTOP_GROUP,
|
|
+ G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN,
|
|
+ NULL);
|
|
+
|
|
return TRUE;
|
|
}
|
|
|
|
@@ -2213,6 +2231,8 @@ g_key_file_get_locale_string (GKeyFile
|
|
GError *key_file_error;
|
|
gchar **languages;
|
|
gboolean free_languages = FALSE;
|
|
+ gboolean try_gettext = FALSE;
|
|
+ const gchar *msg_locale;
|
|
gint i;
|
|
|
|
g_return_val_if_fail (key_file != NULL, NULL);
|
|
@@ -2234,6 +2254,23 @@ g_key_file_get_locale_string (GKeyFile
|
|
free_languages = FALSE;
|
|
}
|
|
|
|
+ /* we're only interested in gettext translation if we don't have a
|
|
+ * translation in the .desktop file itself and if the key is one of the keys
|
|
+ * we know we want to translate: Name, GenericName, Comment. Blindly doing
|
|
+ * this for all keys can give strange result for the icons, since the Icon is
|
|
+ * a locale string in the spec, eg. We also only get translation in the mo
|
|
+ * file if the requested locale is the LC_MESSAGES one. Ideally, we should do
|
|
+ * more and change LC_MESSAGES to use the requested locale, but there's no
|
|
+ * guarantee it's installed on the system and it might have some
|
|
+ * side-effects. Since this is a corner case, let's ignore it. */
|
|
+
|
|
+ msg_locale = setlocale (LC_MESSAGES, NULL);
|
|
+ try_gettext = msg_locale && key_file->gettext_domain &&
|
|
+ strcmp (group_name, G_KEY_FILE_DESKTOP_GROUP) == 0 &&
|
|
+ (strcmp (key, G_KEY_FILE_DESKTOP_KEY_NAME) == 0 ||
|
|
+ strcmp (key, G_KEY_FILE_DESKTOP_KEY_GENERIC_NAME) == 0 ||
|
|
+ strcmp (key, G_KEY_FILE_DESKTOP_KEY_COMMENT) == 0);
|
|
+
|
|
for (i = 0; languages[i]; i++)
|
|
{
|
|
candidate_key = g_strdup_printf ("%s[%s]", key, languages[i]);
|
|
@@ -2250,6 +2287,39 @@ g_key_file_get_locale_string (GKeyFile
|
|
translated_value = NULL;
|
|
}
|
|
|
|
+ /* Fallback to gettext */
|
|
+ if (try_gettext && !translated_value)
|
|
+ {
|
|
+ gchar *orig_value = g_key_file_get_string (key_file, group_name, key, NULL);
|
|
+
|
|
+ if (orig_value)
|
|
+ {
|
|
+ gboolean codeset_set;
|
|
+ const gchar *translated;
|
|
+ gboolean has_gettext;
|
|
+
|
|
+ codeset_set = bind_textdomain_codeset (key_file->gettext_domain, "UTF-8") != NULL;
|
|
+ translated = NULL;
|
|
+
|
|
+ translated = g_dgettext (key_file->gettext_domain,
|
|
+ orig_value);
|
|
+ has_gettext = translated != orig_value;
|
|
+
|
|
+ g_free (orig_value);
|
|
+
|
|
+ if (has_gettext)
|
|
+ {
|
|
+ if (codeset_set)
|
|
+ translated_value = g_strdup (translated);
|
|
+ else
|
|
+ translated_value = g_locale_to_utf8 (translated,
|
|
+ -1, NULL, NULL, NULL);
|
|
+ }
|
|
+ else
|
|
+ translated_value = NULL;
|
|
+ }
|
|
+ }
|
|
+
|
|
/* Fallback to untranslated key
|
|
*/
|
|
if (!translated_value)
|
|
Index: glib-2.66.5/glib/gkeyfile.h
|
|
===================================================================
|
|
--- glib-2.66.5.orig/glib/gkeyfile.h
|
|
+++ glib-2.66.5/glib/gkeyfile.h
|
|
@@ -320,6 +320,7 @@ gboolean g_key_file_remove_group
|
|
#define G_KEY_FILE_DESKTOP_KEY_URL "URL"
|
|
#define G_KEY_FILE_DESKTOP_KEY_DBUS_ACTIVATABLE "DBusActivatable"
|
|
#define G_KEY_FILE_DESKTOP_KEY_ACTIONS "Actions"
|
|
+#define G_KEY_FILE_DESKTOP_KEY_GETTEXT_DOMAIN "X-GNOME-Gettext-Domain"
|
|
|
|
#define G_KEY_FILE_DESKTOP_TYPE_APPLICATION "Application"
|
|
#define G_KEY_FILE_DESKTOP_TYPE_LINK "Link"
|