pdb: Check number of arguments for gimp_file_save ()

gimp_file_save () is used to save both XCF
and export formats like PNG. XCF does
not have a GimpExportOption parameter,
but we were unconditionally copying it.
This patch adds a check for this.
This commit is contained in:
Alx Sa 2024-09-01 01:21:45 +00:00
parent 7eec686585
commit fd091bc005
3 changed files with 17 additions and 7 deletions

View File

@ -232,6 +232,7 @@ file_save_invoker (GimpProcedure *procedure,
GimpPlugInProcedure *file_proc;
GFile *file;
GimpProcedure *proc;
gint custom_args_start = 3;
gint i;
file = g_value_get_object (gimp_value_array_index (args, 2));
@ -259,10 +260,14 @@ file_save_invoker (GimpProcedure *procedure,
gimp_value_array_index (new_args, 1));
g_value_transform (gimp_value_array_index (args, 2),
gimp_value_array_index (new_args, 2));
g_value_transform (gimp_value_array_index (args, 3),
gimp_value_array_index (new_args, 3));
if (proc->num_args > 3)
{
custom_args_start++;
g_value_transform (gimp_value_array_index (args, 3),
gimp_value_array_index (new_args, 3));
}
for (i = 4; i < proc->num_args; i++)
for (i = custom_args_start; i < proc->num_args; i++)
if (G_IS_PARAM_SPEC_STRING (proc->args[i]))
g_value_set_static_string (gimp_value_array_index (new_args, i), "");

View File

@ -250,6 +250,7 @@ HELP
GimpPlugInProcedure *file_proc;
GFile *file;
GimpProcedure *proc;
gint custom_args_start = 3;
gint i;
file = g_value_get_object (gimp_value_array_index (args, 2));
@ -277,10 +278,14 @@ HELP
gimp_value_array_index (new_args, 1));
g_value_transform (gimp_value_array_index (args, 2),
gimp_value_array_index (new_args, 2));
g_value_transform (gimp_value_array_index (args, 3),
gimp_value_array_index (new_args, 3));
if (proc->num_args > 3)
{
custom_args_start++;
g_value_transform (gimp_value_array_index (args, 3),
gimp_value_array_index (new_args, 3));
}
for (i = 4; i < proc->num_args; i++)
for (i = custom_args_start; i < proc->num_args; i++)
if (G_IS_PARAM_SPEC_STRING (proc->args[i]))
g_value_set_static_string (gimp_value_array_index (new_args, i), "");

View File

@ -716,7 +716,7 @@ gzip_export (GFile *infile,
static gboolean
bzip2_load (GFile *infile,
GFile *outfile)
GFile *outfile)
{
gboolean ret;
int fd;