Commit 6f031407 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

don't crash on invalid regular expressions.

2005-05-13  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/pdb/procedural_db.pdb (procedural_db_query): don't
	crash on invalid regular expressions.

	* app/pdb/procedural_db_cmds.c: regenerated.
parent 8403515b
2005-05-13 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/procedural_db.pdb (procedural_db_query): don't
crash on invalid regular expressions.
* app/pdb/procedural_db_cmds.c: regenerated.
2005-05-13 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcontrollerlist.c
......
......@@ -478,13 +478,24 @@ procedural_db_query_invoker (Gimp *gimp,
if (success)
{
regcomp (&pdb_query.name_regex, name, 0);
regcomp (&pdb_query.blurb_regex, blurb, 0);
regcomp (&pdb_query.help_regex, help, 0);
regcomp (&pdb_query.author_regex, author, 0);
regcomp (&pdb_query.copyright_regex, copyright, 0);
regcomp (&pdb_query.date_regex, date, 0);
regcomp (&pdb_query.proc_type_regex, proc_type, 0);
success = FALSE;
if (regcomp (&pdb_query.name_regex, name, 0))
goto free_name;
if (regcomp (&pdb_query.blurb_regex, blurb, 0))
goto free_blurb;
if (regcomp (&pdb_query.help_regex, help, 0))
goto free_help;
if (regcomp (&pdb_query.author_regex, author, 0))
goto free_author;
if (regcomp (&pdb_query.copyright_regex, copyright, 0))
goto free_copyright;
if (regcomp (&pdb_query.date_regex, date, 0))
goto free_date;
if (regcomp (&pdb_query.proc_type_regex, proc_type, 0))
goto free_proc_type;
success = TRUE;
pdb_query.gimp = gimp;
pdb_query.list_of_procs = NULL;
......@@ -499,13 +510,20 @@ procedural_db_query_invoker (Gimp *gimp,
g_hash_table_foreach (gimp->procedural_compat_ht,
procedural_db_query_entry, &pdb_query);
regfree (&pdb_query.name_regex);
regfree (&pdb_query.blurb_regex);
regfree (&pdb_query.help_regex);
regfree (&pdb_query.author_regex);
regfree (&pdb_query.copyright_regex);
regfree (&pdb_query.date_regex);
regfree (&pdb_query.proc_type_regex);
free_proc_type:
regfree (&pdb_query.proc_type_regex);
free_date:
regfree (&pdb_query.date_regex);
free_copyright:
regfree (&pdb_query.copyright_regex);
free_author:
regfree (&pdb_query.author_regex);
free_help:
regfree (&pdb_query.help_regex);
free_blurb:
regfree (&pdb_query.blurb_regex);
free_name:
regfree (&pdb_query.name_regex);
}
return_args = procedural_db_return_args (&procedural_db_query_proc, success);
......
......@@ -187,16 +187,21 @@ HELP
&std_pdb_misc;
my $regcomp = ""; my $free = ""; $once = 0;
my $regcomp = ""; $once = 0;
foreach (qw(name blurb help author copyright date proc_type)) {
push @inargs, { name => $_, type => 'string', no_validate => 1,
desc => "The regex for procedure $_" };
$regcomp .= ' ' x 2 if $once;
$regcomp .= "regcomp (&pdb_query.${_}_regex, $_, 0);\n";
$regcomp .= ' ' x 2 if $once++;
$regcomp .= "if (regcomp (&pdb_query.${_}_regex, $_, 0))\n";
$regcomp .= " goto free_${_};\n";
}
my $free = ""; $once = 0;
foreach (qw(proc_type date copyright author help blurb name)) {
$free .= ' ' x 2 if $once++;
$free .= "regfree (&pdb_query.${_}_regex);\n";
$free .= "free_${_}:\n";
$free .= " regfree (&pdb_query.${_}_regex);\n";
}
chop $free;
......@@ -220,7 +225,12 @@ HELP
vars => [ 'PDBQuery pdb_query' ],
code => <<CODE
{
success = FALSE;
$regcomp
success = TRUE;
pdb_query.gimp = gimp;
pdb_query.list_of_procs = NULL;
pdb_query.num_procs = 0;
......
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