Skip to content

gobject: new g_param_is_valid_property_name() function.

Making this validation code public allows projects to validate a GParamSpec name before creating it. While hard-coded GParam don't need this, we can't afford crashing the main program for dynamically generated GParam from user-created data.

In such case, we will need to validate the param names and return errors instead of trying to create a GParam with these names.

Some context: in GIMP, we have various usages of dynamically generated GParamSpec, for instance for API created by plug-ins. Therefore this is user-provided data, which can be invalid for GParamSpec arguments. Right now, we don't validate the data, which means a user-provided plug-in has the ability to crash GIMP core by providing an invalid name. That's not cool.

Obviously we could just reimplement/copy-paste the validation code, but since it obviously already exist in glib, it seems a bit stupid. Moreover if the code/rules ever change on glib side and we don't notice it, we might end up with inconsistent check. So I'm just suggesting for this existing function to become public.

Edited by Philip Withnall

Merge request reports