Merge branch 'lillolollo-master-patch-25038' into 'master'

plug-ins/file-lnk avoid possible underflow

See merge request GNOME/gimp!2118
This commit is contained in:
lillolollo 2025-07-02 22:12:06 +00:00
commit dfcec81a23

View file

@ -252,8 +252,13 @@ load_image (GFile *file,
/* Length of the filename */ /* Length of the filename */
link_size = length - link_pos - 1; link_size = length - link_pos - 1;
if (link_size > 0) if (link_size <= 0) {
{ g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
_("Invalid file."));
fclose (fp);
return NULL;
}
gchar file_name[link_size]; gchar file_name[link_size];
/* Jump to link address and read in the real file name */ /* Jump to link address and read in the real file name */
@ -274,7 +279,6 @@ load_image (GFile *file,
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
"%s", gimp_pdb_get_last_error (gimp_get_pdb ())); "%s", gimp_pdb_get_last_error (gimp_get_pdb ()));
}
fclose (fp); fclose (fp);
return image; return image;