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.
This commit is contained in:
Jehan 2019-12-24 02:05:19 +01:00
parent 44a7adfd9d
commit 9399c937df
1 changed files with 6 additions and 0 deletions

View File

@ -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;