[gnome-photos/wip/rishi/issue-115] base-item: Don't attempt to load non-UTF-8 paths
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/issue-115] base-item: Don't attempt to load non-UTF-8 paths
- Date: Mon, 17 Sep 2018 18:24:06 +0000 (UTC)
commit 9bc8dea111f5ccc0a400fe416d5c0a651c100f93
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Sep 17 20:16:53 2018 +0200
base-item: Don't attempt to load non-UTF-8 paths
Since, gegl:load insists on UTF-8 encoded paths and it's difficult to
handle errors from it, validate the path earlier and error out. This
silences the following WARNING:
GLib-GObject-WARNING **: 20:13:59.111: value ""/non-UTF-8/path"" of
type 'gchararray' is invalid or out of range for property 'path'
of type 'gchararray'
https://gitlab.gnome.org/GNOME/gnome-photos/issues/115
src/photos-base-item.c | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 8e170d1c..5541fc8a 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -1476,6 +1476,12 @@ photos_base_item_load_buffer (PhotosBaseItem *self, GCancellable *cancellable, G
if (path == NULL)
goto out;
+ if (!g_utf8_validate (path, -1, NULL))
+ {
+ g_set_error (error, PHOTOS_ERROR, 0, "Path is not UTF-8 encoded");
+ goto out;
+ }
+
graph = gegl_node_new ();
load = gegl_node_new_child (graph, "operation", "gegl:load", "path", path, NULL);
buffer_sink = gegl_node_new_child (graph, "operation", "gegl:buffer-sink", "buffer", &buffer, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]