Commit f480d028 authored by Michael Natterer's avatar Michael Natterer 😴

libgimp: add precondition checks for gimp_is_canonical_identifier()

on all procedure name parameters.
parent 11ce199c
Pipeline #105613 passed with stages
in 20 minutes and 17 seconds
...@@ -140,7 +140,7 @@ gimp_pdb_procedure_exists (GimpPDB *pdb, ...@@ -140,7 +140,7 @@ gimp_pdb_procedure_exists (GimpPDB *pdb,
const gchar *procedure_name) const gchar *procedure_name)
{ {
g_return_val_if_fail (GIMP_IS_PDB (pdb), FALSE); g_return_val_if_fail (GIMP_IS_PDB (pdb), FALSE);
g_return_val_if_fail (procedure_name != NULL, FALSE); g_return_val_if_fail (gimp_is_canonical_identifier (procedure_name), FALSE);
return _gimp_pdb_proc_exists (procedure_name); return _gimp_pdb_proc_exists (procedure_name);
} }
...@@ -167,7 +167,7 @@ gimp_pdb_lookup_procedure (GimpPDB *pdb, ...@@ -167,7 +167,7 @@ gimp_pdb_lookup_procedure (GimpPDB *pdb,
GimpProcedure *procedure; GimpProcedure *procedure;
g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL); g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL);
g_return_val_if_fail (procedure_name != NULL, NULL); g_return_val_if_fail (gimp_is_canonical_identifier (procedure_name), NULL);
procedure = g_hash_table_lookup (pdb->priv->procedures, procedure_name); procedure = g_hash_table_lookup (pdb->priv->procedures, procedure_name);
...@@ -207,7 +207,7 @@ gimp_pdb_run_procedure (GimpPDB *pdb, ...@@ -207,7 +207,7 @@ gimp_pdb_run_procedure (GimpPDB *pdb,
va_list args; va_list args;
g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL); g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL);
g_return_val_if_fail (procedure_name != NULL, NULL); g_return_val_if_fail (gimp_is_canonical_identifier (procedure_name), NULL);
va_start (args, first_type); va_start (args, first_type);
...@@ -244,7 +244,7 @@ gimp_pdb_run_procedure_valist (GimpPDB *pdb, ...@@ -244,7 +244,7 @@ gimp_pdb_run_procedure_valist (GimpPDB *pdb,
gchar *error_msg = NULL; gchar *error_msg = NULL;
g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL); g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL);
g_return_val_if_fail (procedure_name != NULL, NULL); g_return_val_if_fail (gimp_is_canonical_identifier (procedure_name), NULL);
arguments = gimp_value_array_new_from_types_valist (&error_msg, arguments = gimp_value_array_new_from_types_valist (&error_msg,
first_type, first_type,
...@@ -293,7 +293,7 @@ gimp_pdb_run_procedure_array (GimpPDB *pdb, ...@@ -293,7 +293,7 @@ gimp_pdb_run_procedure_array (GimpPDB *pdb,
GimpValueArray *return_values; GimpValueArray *return_values;
g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL); g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL);
g_return_val_if_fail (procedure_name != NULL, NULL); g_return_val_if_fail (gimp_is_canonical_identifier (procedure_name), NULL);
g_return_val_if_fail (arguments != NULL, NULL); g_return_val_if_fail (arguments != NULL, NULL);
proc_run.name = (gchar *) procedure_name; proc_run.name = (gchar *) procedure_name;
......
...@@ -187,7 +187,7 @@ _gimp_pdb_procedure_new (GimpPDB *pdb, ...@@ -187,7 +187,7 @@ _gimp_pdb_procedure_new (GimpPDB *pdb,
gint i; gint i;
g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL); g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL);
g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (gimp_is_canonical_identifier (name), NULL);
_gimp_pdb_proc_info (name, _gimp_pdb_proc_info (name,
&blurb, &blurb,
......
...@@ -349,7 +349,7 @@ gimp_plug_in_create_procedure (GimpPlugIn *plug_in, ...@@ -349,7 +349,7 @@ gimp_plug_in_create_procedure (GimpPlugIn *plug_in,
const gchar *procedure_name) const gchar *procedure_name)
{ {
g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in), NULL); g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in), NULL);
g_return_val_if_fail (procedure_name != NULL, NULL); g_return_val_if_fail (gimp_is_canonical_identifier (procedure_name), NULL);
if (GIMP_PLUG_IN_GET_CLASS (plug_in)->create_procedure) if (GIMP_PLUG_IN_GET_CLASS (plug_in)->create_procedure)
return GIMP_PLUG_IN_GET_CLASS (plug_in)->create_procedure (plug_in, return GIMP_PLUG_IN_GET_CLASS (plug_in)->create_procedure (plug_in,
...@@ -414,7 +414,7 @@ gimp_plug_in_remove_temp_procedure (GimpPlugIn *plug_in, ...@@ -414,7 +414,7 @@ gimp_plug_in_remove_temp_procedure (GimpPlugIn *plug_in,
GimpProcedure *procedure; GimpProcedure *procedure;
g_return_if_fail (GIMP_IS_PLUG_IN (plug_in)); g_return_if_fail (GIMP_IS_PLUG_IN (plug_in));
g_return_if_fail (procedure_name != NULL); g_return_if_fail (gimp_is_canonical_identifier (procedure_name));
procedure = gimp_plug_in_get_temp_procedure (plug_in, procedure_name); procedure = gimp_plug_in_get_temp_procedure (plug_in, procedure_name);
...@@ -468,7 +468,7 @@ gimp_plug_in_get_temp_procedure (GimpPlugIn *plug_in, ...@@ -468,7 +468,7 @@ gimp_plug_in_get_temp_procedure (GimpPlugIn *plug_in,
GList *list; GList *list;
g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in), NULL); g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in), NULL);
g_return_val_if_fail (procedure_name != NULL, NULL); g_return_val_if_fail (gimp_is_canonical_identifier (procedure_name), NULL);
for (list = plug_in->priv->temp_procedures; list; list = g_list_next (list)) for (list = plug_in->priv->temp_procedures; list; list = g_list_next (list))
{ {
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <gegl.h> #include <gegl.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h" #include "libgimpwidgets/gimpwidgets.h"
#include "gimp.h" #include "gimp.h"
...@@ -97,7 +98,7 @@ gimp_proc_view_new (const gchar *procedure_name, ...@@ -97,7 +98,7 @@ gimp_proc_view_new (const gchar *procedure_name,
const gchar *type_str; const gchar *type_str;
gint row; gint row;
g_return_val_if_fail (procedure_name != NULL, NULL); g_return_val_if_fail (gimp_is_canonical_identifier (procedure_name), NULL);
procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (), procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (),
procedure_name); procedure_name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment