[gimp/gimp-2-10] Issue #1719 - GIMP crashes with an invalid pluginrc
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] Issue #1719 - GIMP crashes with an invalid pluginrc
- Date: Tue, 26 Jun 2018 13:02:23 +0000 (UTC)
commit 41807ace5c976b8b4f3ef7fbd622a8a1521b9251
Author: Michael Natterer <mitch gimp org>
Date: Tue Jun 26 14:58:33 2018 +0200
Issue #1719 - GIMP crashes with an invalid pluginrc
Check the return value of gimp_file_new_for_config_path() and set
an error if it returns NULL.
(cherry picked from commit c6aa613f9c9b35f11ad198663269ec4822e0cda3)
app/plug-in/plug-in-rc.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/app/plug-in/plug-in-rc.c b/app/plug-in/plug-in-rc.c
index 81ead35397..411d997191 100644
--- a/app/plug-in/plug-in-rc.c
+++ b/app/plug-in/plug-in-rc.c
@@ -45,7 +45,8 @@
/*
* All deserialize functions return G_TOKEN_LEFT_PAREN on success,
- * or the GTokenType they would have expected but didn't get.
+ * or the GTokenType they would have expected but didn't get,
+ * or G_TOKEN_ERROR if the function already set an error itself.
*/
static GTokenType plug_in_def_deserialize (Gimp *gimp,
@@ -238,7 +239,7 @@ plug_in_rc_parse (Gimp *gimp,
_("Skipping '%s': wrong pluginrc file format version."),
gimp_file_get_utf8_name (file));
}
- else
+ else if (token != G_TOKEN_ERROR)
{
g_scanner_get_next_token (scanner);
g_scanner_unexp_token (scanner, token, NULL, NULL, NULL,
@@ -267,13 +268,23 @@ plug_in_def_deserialize (Gimp *gimp,
GFile *file;
gint64 mtime;
GTokenType token;
+ GError *error = NULL;
if (! gimp_scanner_parse_string (scanner, &path))
return G_TOKEN_STRING;
- file = gimp_file_new_for_config_path (path, NULL);
+ file = gimp_file_new_for_config_path (path, &error);
g_free (path);
+ if (! file)
+ {
+ g_scanner_error (scanner,
+ "unable to parse plug-in filename: %s",
+ error->message);
+ g_clear_error (&error);
+ return G_TOKEN_ERROR;
+ }
+
plug_in_def = gimp_plug_in_def_new (file);
g_object_unref (file);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]