[gimp] Issue #4392: Gimp Segmentation Fault triggered by Glib GParamSpec...



commit 9399c937dface9ac5f8cb7b16121323105362a9a
Author: Jehan <jehan girinstud io>
Date:   Tue Dec 24 02:05:19 2019 +0100

    Issue #4392: Gimp Segmentation Fault triggered by Glib GParamSpec...
    
    ... property name validation.
    Slightly different fix on master compared to the gimp-2-10 branch. Here
    the GParamSpec creation will happen already on the plug-in process in
    libgimp. Let's just make sure we abort before we segfault.
    
    This will be enough for the plug-in developer to start debugging one's
    code. At least the core process is not crashing when the plug-in dev
    provides invalid param names.

 libgimp/gimpparamspecs-body.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/libgimp/gimpparamspecs-body.c b/libgimp/gimpparamspecs-body.c
index fe8163876b..bdbf47e1d4 100644
--- a/libgimp/gimpparamspecs-body.c
+++ b/libgimp/gimpparamspecs-body.c
@@ -383,6 +383,12 @@ gimp_param_spec_layer (const gchar *name,
 
   ispec = g_param_spec_internal (GIMP_TYPE_PARAM_LAYER,
                                  name, nick, blurb, flags);
+  /* g_param_spec_internal() may fail if for instance @name is invalid.
+   * We don't want to dereference the pointer and segfault in such a
+   * case, so let's just fail here.
+   * See #4392.
+   */
+  g_return_val_if_fail (ispec, NULL);
 
   ispec->none_ok = none_ok ? TRUE : FALSE;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]