From 7b3052dcdd1a1de9e25f62279568af8f8881df64 Mon Sep 17 00:00:00 2001 From: Jehan Date: Mon, 2 Mar 2026 16:58:11 +0100 Subject: [PATCH] =?UTF-8?q?app:=20fix=20a=20crash=20in=20GIMP=20when=20cal?= =?UTF-8?q?ling=20gimp:curves=20with=20GIMP=5FHISTOGRAM=5FLUMINANCE?= =?UTF-8?q?=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … from a plug-in. The value is accepted by the current specification of "channel" but it is actually not supported and would end up crashing the core process. The real fix which should happen would be to make GimpParamSpecEnum usable in libgimp, and be able to pass its spec through the PDB. Then we could use this param spec instead of GParamSpecEnum for such property not supporting all values in an enum. Note that with the current fix, the "gimp:curves" filter will silently refuse the Luminance channel when passed as "channel". It is not ideal. But it's better than crashing the whole of GIMP! --- app/operations/gimpcurvesconfig.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/operations/gimpcurvesconfig.c b/app/operations/gimpcurvesconfig.c index b4424e23d8..e35751669f 100644 --- a/app/operations/gimpcurvesconfig.c +++ b/app/operations/gimpcurvesconfig.c @@ -119,6 +119,15 @@ gimp_curves_config_class_init (GimpCurvesConfigClass *klass) _("Work on linear RGB (this property is ignored; use \"trc\" instead)"), TRUE, 0); + /* Only channels GIMP_HISTOGRAM_VALUE to GIMP_HISTOGRAM_ALPHA are + * supported right now in this op. Unfortunately this is not visible + * through the param specification. The GimpParamSpecEnum would allow + * to make it visible, but it does not exist on libgimp side right + * now, so plug-in writers would see it listed as allowed. + * + * TODO: GimpParamSpecEnum should be moved to libgimpbase + * (libgimpbase/gimpparamspecs.h) and passed through PDB. + */ GIMP_CONFIG_PROP_ENUM (object_class, PROP_CHANNEL, "channel", _("Channel"), @@ -231,8 +240,12 @@ gimp_curves_config_set_property (GObject *object, break; case PROP_CHANNEL: - self->channel = g_value_get_enum (value); - g_object_notify (object, "curve"); + if (g_value_get_enum (value) >= GIMP_HISTOGRAM_VALUE && + g_value_get_enum (value) <= GIMP_HISTOGRAM_ALPHA) + { + self->channel = g_value_get_enum (value); + g_object_notify (object, "curve"); + } break; case PROP_CURVE: