Issue #1719 - GIMP crashes with an invalid pluginrc
Fix 3 more crashes caused by accepting broken input, spotted by Massimo.
This commit is contained in:
@ -273,6 +273,12 @@ plug_in_def_deserialize (Gimp *gimp,
|
|||||||
if (! gimp_scanner_parse_string (scanner, &path))
|
if (! gimp_scanner_parse_string (scanner, &path))
|
||||||
return G_TOKEN_STRING;
|
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);
|
file = gimp_file_new_for_config_path (path, &error);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
|
|
||||||
@ -383,12 +389,27 @@ plug_in_procedure_deserialize (GScanner *scanner,
|
|||||||
if (! gimp_scanner_parse_string (scanner, &str))
|
if (! gimp_scanner_parse_string (scanner, &str))
|
||||||
return G_TOKEN_STRING;
|
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))
|
if (! gimp_scanner_parse_int (scanner, &proc_type))
|
||||||
{
|
{
|
||||||
g_free (str);
|
g_free (str);
|
||||||
return G_TOKEN_INT;
|
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);
|
procedure = gimp_plug_in_procedure_new (proc_type, file);
|
||||||
|
|
||||||
*proc = GIMP_PLUG_IN_PROCEDURE (procedure);
|
*proc = GIMP_PLUG_IN_PROCEDURE (procedure);
|
||||||
|
Reference in New Issue
Block a user