mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-21 20:12:30 +00:00
file-png: Check that PNG structs are created properly
If there's a version mismatch between compiled version (header) and installed shared libpng library, structs are not created and NULL is returned.
This commit is contained in:
parent
3145c80aba
commit
1ac6c7b85c
|
@ -720,6 +720,14 @@ load_image (const gchar *filename,
|
|||
gint num_texts;
|
||||
|
||||
pp = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
if (!pp)
|
||||
{
|
||||
g_set_error (error, 0, 0,
|
||||
_("Error creating PNG read struct while saving '%s'."),
|
||||
gimp_filename_to_utf8 (filename));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
info = png_create_info_struct (pp);
|
||||
|
||||
if (setjmp (png_jmpbuf (pp)))
|
||||
|
@ -1247,6 +1255,14 @@ save_image (const gchar *filename,
|
|||
png_textp text = NULL;
|
||||
|
||||
pp = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
if (!pp)
|
||||
{
|
||||
g_set_error (error, 0, 0,
|
||||
_("Error creating PNG write struct while saving '%s'."),
|
||||
gimp_filename_to_utf8 (filename));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
info = png_create_info_struct (pp);
|
||||
|
||||
if (setjmp (png_jmpbuf (pp)))
|
||||
|
|
Loading…
Reference in a new issue