[gdk-pixbuf/wip/hadess/split-loaders: 6/8] core: Add gdk_pixbuf_init_modules() for applications
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdk-pixbuf/wip/hadess/split-loaders: 6/8] core: Add gdk_pixbuf_init_modules() for applications
- Date: Thu, 28 Feb 2019 16:28:16 +0000 (UTC)
commit fd1376b799e411f983ab6faa00b066a8007ad9a1
Author: Bastien Nocera <hadess hadess net>
Date: Wed Aug 2 11:25:11 2017 +0100
core: Add gdk_pixbuf_init_modules() for applications
gdk_pixbuf_init_modules() should be used by applications which
want to have gdk-pixbuf loader modules install in a separate
path, usually in the application's library directory.
https://bugzilla.gnome.org/show_bug.cgi?id=786035
gdk-pixbuf/gdk-pixbuf-io.c | 34 ++++++++++++++++++++++++++++++++++
gdk-pixbuf/gdk-pixbuf-io.h | 4 ++++
2 files changed, 38 insertions(+)
---
diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
index 820a9b887..12dcbe71b 100644
--- a/gdk-pixbuf/gdk-pixbuf-io.c
+++ b/gdk-pixbuf/gdk-pixbuf-io.c
@@ -555,6 +555,40 @@ gdk_pixbuf_io_init_modules (const char *filename,
return TRUE;
}
+/**
+ * gdk_pixbuf_init_modules:
+ * @path: Path to directory where the loaders.cache is installed
+ *
+ * Initalizes the gdk-pixbuf loader modules referenced by the loaders.cache
+ * file present inside that directory.
+ *
+ * This is to be used by applications that want to ship certain loaders
+ * in a different location from the system ones.
+ *
+ * This is needed when the OS or runtime ships a minimal number of loaders
+ * so as to reduce the potential attack surface of carefully crafted image
+ * files, especially for uncommon file types. Applications that require
+ * broader image file types coverage, such as image viewers, would be
+ * expected to ship the gdk-pixbuf modules in a separate location, bundled
+ * with the application in a separate directory from the OS or runtime-
+ * provided modules.
+ *
+ * Since: 2.40
+ */
+gboolean
+gdk_pixbuf_init_modules (const char *path,
+ GError **error)
+{
+ char *filename;
+ gboolean ret;
+
+ g_return_val_if_fail (path != NULL, FALSE);
+ filename = g_build_filename (path, "loaders.cache", NULL);
+ ret = gdk_pixbuf_io_init_modules (filename, error);
+ g_free (filename);
+ return ret;
+}
+
static void
gdk_pixbuf_io_init_builtin (void)
{
diff --git a/gdk-pixbuf/gdk-pixbuf-io.h b/gdk-pixbuf/gdk-pixbuf-io.h
index 88e21b563..66074bc69 100644
--- a/gdk-pixbuf/gdk-pixbuf-io.h
+++ b/gdk-pixbuf/gdk-pixbuf-io.h
@@ -41,6 +41,10 @@ G_BEGIN_DECLS
typedef struct _GdkPixbufFormat GdkPixbufFormat;
+GDK_PIXBUF_AVAILABLE_IN_2_40
+gboolean gdk_pixbuf_init_modules (const char *path,
+ GError **error);
+
GDK_PIXBUF_AVAILABLE_IN_ALL
GType gdk_pixbuf_format_get_type (void) G_GNUC_CONST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]