[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-27 366a97c: Avoid crashes when trying to load bad GIF files
From: |
Eli Zaretskii |
Subject: |
emacs-27 366a97c: Avoid crashes when trying to load bad GIF files |
Date: |
Tue, 8 Sep 2020 12:17:44 -0400 (EDT) |
branch: emacs-27
commit 366a97c980f068a3ed665d337d644ee58cd25ca0
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Avoid crashes when trying to load bad GIF files
* src/image.c (gif_load): Handle the case when GifErrorString
returns NULL. (Bug#43281)
---
src/image.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/src/image.c b/src/image.c
index 56878bc..956fb13 100644
--- a/src/image.c
+++ b/src/image.c
@@ -8160,11 +8160,13 @@ gif_load (struct frame *f, struct image *img)
if (gif == NULL)
{
#if HAVE_GIFERRORSTRING
- image_error ("Cannot open `%s': %s",
- file, build_string (GifErrorString (gif_err)));
-#else
- image_error ("Cannot open `%s'", file);
+ const char *errstr = GifErrorString (gif_err);
+ if (errstr)
+ image_error ("Cannot open `%s': %s", file, build_string (errstr));
+ else
#endif
+ image_error ("Cannot open `%s'", file);
+
return 0;
}
}
@@ -8190,11 +8192,13 @@ gif_load (struct frame *f, struct image *img)
if (!gif)
{
#if HAVE_GIFERRORSTRING
- image_error ("Cannot open memory source `%s': %s",
- img->spec, build_string (GifErrorString (gif_err)));
-#else
- image_error ("Cannot open memory source `%s'", img->spec);
+ const char *errstr = GifErrorString (gif_err);
+ if (errstr)
+ image_error ("Cannot open memory source `%s': %s",
+ img->spec, build_string (errstr));
+ else
#endif
+ image_error ("Cannot open memory source `%s'", img->spec);
return 0;
}
}
@@ -8474,9 +8478,9 @@ gif_load (struct frame *f, struct image *img)
if (error_text)
image_error ("Error closing `%s': %s",
img->spec, build_string (error_text));
-#else
- image_error ("Error closing `%s'", img->spec);
+ else
#endif
+ image_error ("Error closing `%s'", img->spec);
}
/* Maybe fill in the background field while we have ximg handy. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-27 366a97c: Avoid crashes when trying to load bad GIF files,
Eli Zaretskii <=