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

Issue #1719 - GIMP crashes with an invalid pluginrc

Fix 3 more crashes caused by accepting broken input, spotted by
Massimo.

(cherry picked from commit 7db59e7a)
parent 960494c5
......@@ -273,6 +273,12 @@ plug_in_def_deserialize (Gimp *gimp,
if (! gimp_scanner_parse_string (scanner, &path))
return G_TOKEN_STRING;
if (! (path && *path))
{
g_scanner_error (scanner, "plug-in filename is empty");
return G_TOKEN_ERROR;
}
file = gimp_file_new_for_config_path (path, &error);
g_free (path);
......@@ -383,12 +389,27 @@ plug_in_procedure_deserialize (GScanner *scanner,
if (! gimp_scanner_parse_string (scanner, &str))
return G_TOKEN_STRING;
if (! (str && *str))
{
g_scanner_error (scanner, "procedure name is empty");
return G_TOKEN_ERROR;
}
if (! gimp_scanner_parse_int (scanner, &proc_type))
{
g_free (str);
return G_TOKEN_INT;
}
if (proc_type != GIMP_PLUGIN &&
proc_type != GIMP_EXTENSION)
{
g_free (str);
g_scanner_error (scanner, "procedure type %d is out of range",
proc_type);
return G_TOKEN_ERROR;
}
procedure = gimp_plug_in_procedure_new (proc_type, file);
*proc = GIMP_PLUG_IN_PROCEDURE (procedure);
......
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