diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2022-03-03 19:03:29 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2022-03-03 19:03:29 +0000 |
commit | ae9047b1ed4485b8f3972052dc98f201906888b4 (patch) | |
tree | 797668a9c2ee4727cb45c35b27b0211cba9d707c /content/handlers/image | |
parent | 2e9ef8feae321d9a8463c816a356eb73d789b6c7 (diff) | |
download | netsurf-ae9047b1ed4485b8f3972052dc98f201906888b4.tar.gz netsurf-ae9047b1ed4485b8f3972052dc98f201906888b4.tar.bz2 |
GIF: Tolerate errors during scan if at least one frame.
Diffstat (limited to 'content/handlers/image')
-rw-r--r-- | content/handlers/image/gif.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/content/handlers/image/gif.c b/content/handlers/image/gif.c index 0d4506ab0..49aed73e0 100644 --- a/content/handlers/image/gif.c +++ b/content/handlers/image/gif.c @@ -37,6 +37,7 @@ #include <nsgif.h> +#include "utils/log.h" #include "utils/utils.h" #include "utils/messages.h" #include "utils/nsoption.h" @@ -211,18 +212,21 @@ static bool gif_convert(struct content *c) /* Initialise the GIF */ gif_err = nsgif_data_scan(gif->gif, size, data); if (gif_err != NSGIF_OK) { - err = gif__nsgif_error_to_ns(gif_err); - content_broadcast_error(c, err, nsgif_strerror(gif_err)); - return false; + NSLOG(netsurf, DEBUG, "%s", nsgif_strerror(gif_err)); + /* Not fatal unless er have no frames. */ } gif_info = nsgif_get_info(gif->gif); assert(gif_info != NULL); /* Abort on bad GIFs */ - if (gif_info->height == 0) { + if (gif_info->frame_count == 0) { + err = gif__nsgif_error_to_ns(gif_err); + content_broadcast_error(c, err, "GIF with no frames."); + return false; + } else if (gif_info->width == 0 || gif_info->height == 0) { err = gif__nsgif_error_to_ns(gif_err); - content_broadcast_error(c, err, "Zero height image."); + content_broadcast_error(c, err, "Zero size image."); return false; } |